GetCurrentNodeAndHintAncestorNodes Method

SiteMapProvider.GetCurrentNodeAndHintAncestorNodes Method

Provides an optimized lookup method for site map providers when retrieving the node for the currently requested page and fetching the parent and ancestor site map nodes for the current page.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

public virtual SiteMapNode GetCurrentNodeAndHintAncestorNodes (
	int upLevel
public SiteMapNode GetCurrentNodeAndHintAncestorNodes (
	int upLevel
public function GetCurrentNodeAndHintAncestorNodes (
	upLevel : int
) : SiteMapNode
Not applicable.



The number of ancestor site map node generations to get. A value of -1 indicates that all ancestors might be retrieved and cached by the provider.

Return Value

A SiteMapNode that represents the currently requested page; otherwise, a null reference (Nothing in Visual Basic), if the SiteMapNode is not found or cannot be returned for the current user.

Exception typeCondition


upLevel is less than -1.

The default implementation of the GetCurrentNodeAndHintAncestorNodes method returns the CurrentNode property; however, site map providers can override the GetCurrentNodeAndHintAncestorNodes method and provide an optimized implementation that uses custom caching mechanisms to return the current SiteMapNode, as well as the parent and ancestor nodes of the parent.

The upLevel parameter is used to specify how many levels of parent and ancestor nodes to retrieve. If preferred, the parent and ancestor nodes can be linked to the SiteMapNode object that is returned by the GetCurrentNodeAndHintAncestorNodes method, using the ParentNode property.

The XmlSiteMapProvider class, which is the default site map provider for ASP.NET, caches the entire site map in memory, which results in little or no overhead when querying the XmlSiteMapProvider for specific SiteMapNode objects.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

© 2016 Microsoft