System.Web.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.

Syntax

public virtual SiteMapNode GetCurrentNodeAndHintAncestorNodes (int upLevel)

Parameters

upLevel
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.

Returns

A System.Web.SiteMapNode that represents the currently requested page; otherwise, null, if the System.Web.SiteMapNode is not found or cannot be returned for the current user.

Remarks

The default implementation of the SiteMapProvider.GetCurrentNodeAndHintAncestorNodes(int) method returns the SiteMapProvider.CurrentNode property; however, site map providers can override the SiteMapProvider.GetCurrentNodeAndHintAncestorNodes(int) method and provide an optimized implementation that uses custom caching mechanisms to return the current System.Web.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 System.Web.SiteMapNode object that is returned by the SiteMapProvider.GetCurrentNodeAndHintAncestorNodes(int) method, using the SiteMapNode.ParentNode property.

The System.Web.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 System.Web.XmlSiteMapProvider for specific System.Web.SiteMapNode objects.

Requirements

Namespace: System.Web
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0