System.Web.SiteMapProvider.FindSiteMapNodeFromKey Method

Retrieves a System.Web.SiteMapNode object based on a specified key.

Syntax

public virtual SiteMapNode FindSiteMapNodeFromKey (string key)

Parameters

key
A lookup key with which a System.Web.SiteMapNode is created.

Returns

A System.Web.SiteMapNode that represents the page identified by key; otherwise, null, if no corresponding System.Web.SiteMapNode is found or if security trimming is enabled and the System.Web.SiteMapNode cannot be returned for the current user. The default is null.

Remarks

The System.Web.SiteMapProvider implementation returns null in all cases. Classes that derive from the System.Web.SiteMapProvider class can override the SiteMapProvider.FindSiteMapNodeFromKey(string) method to provide lookup functionality based on a unique key (instead of a URL, which is used by the erload:System.Web.SiteMapProvider.FindSiteMapNode method). Implement the SiteMapProvider.FindSiteMapNodeFromKey(string) method if your site map provider implementation uses the SiteMapNode.Key property of a System.Web.SiteMapNode object as a primary identifier in a site map structure.

The System.Web.StaticSiteMapProvider class provides an implementation that handles searching for site map nodes that do not define a URL.

The System.Web.XmlSiteMapProvider class, which is the default site map provider for ASP.NET, uses the URL of a System.Web.SiteMapNode as a key in the various collections that the classes maintain. Therefore, if a node provides a URL, it must be unique within the scope of the site map provider. If no URL is provided, a unique identifier is generated to identify the System.Web.SiteMapNode.

Requirements

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