System.Web.SiteMapProvider.GetCurrentNodeAndHintNeighborhoodNodes Method

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

Syntax

public virtual SiteMapNode GetCurrentNodeAndHintNeighborhoodNodes (int upLevel, int downLevel)

Parameters

upLevel
The number of ancestor System.Web.SiteMapNode generations to fetch. 0 indicates no ancestor nodes are retrieved and -1 indicates that all ancestors might be retrieved and cached by the provider.
downLevel
The number of child System.Web.SiteMapNode generations to fetch. 0 indicates no descendant nodes are retrieved and a -1 indicates that all descendant nodes 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.GetCurrentNodeAndHintNeighborhoodNodes(int, int) method returns the SiteMapProvider.CurrentNode property; however, site map providers can override the SiteMapProvider.GetCurrentNodeAndHintNeighborhoodNodes(int, int) method and provide an optimized implementation that uses custom caching mechanisms to return the current System.Web.SiteMapNode object, as well as System.Web.SiteMapNode objects that are in the proximity of the current System.Web.SiteMapNode.

The upLevel parameter is used to specify how many levels of parent and ancestor nodes to retrieve and cache, along with their immediate children. The downLevel parameter is used to specify how many levels of descendant nodes from the current System.Web.SiteMapNode to retrieve. If preferred, the ancestor and descendant nodes can be linked to the System.Web.SiteMapNode that is returned by the

SiteMapProvider.GetCurrentNodeAndHintNeighborhoodNodes(int, int) method, using the SiteMapNode.ParentNode and SiteMapNode.ChildNodes properties. If there are fewer ancestor or child node levels than are specified by upLevel or downLevel, only those that are available are retrieved.

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