This documentation is archived and is not being maintained.

StaticSiteMapProvider::FindSiteMapNodeFromKey Method

Retrieves a SiteMapNode object based on a specified key.

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

public:
virtual SiteMapNode^ FindSiteMapNodeFromKey(
	String^ key
) override

Parameters

key
Type: System::String

A lookup key with which a SiteMapNode is created.

Return Value

Type: System.Web::SiteMapNode
A SiteMapNode that represents the page identified by key; otherwise, nullptr, if security trimming is enabled and the site map node cannot be shown to the current user or the site map node is not found in the site map node collection by key.

The FindSiteMapNodeFromKey method retrieves a site map node from an internal Hashtable object based on key.

The XmlSiteMapProvider object, which is derived from the StaticSiteMapProvider class and is the default site map provider for ASP.NET, uses the Url property of a SiteMapNode object as a lookup key in its internal collections, by default. If the Url property of the SiteMapNode is set, it must be unique within the scope of the site map provider. The FindSiteMapNode method attempts to retrieve site map nodes based on their Url. Otherwise, you can use the Key property and the corresponding FindSiteMapNodeFromKey method to retrieve site map nodes.

The StaticSiteMapProvider has a default implementation that looks up instances of the SiteMapNode class based on the key parameter. If a site map provider implementer used the AddNode method, the StaticSiteMapProvider already will have stored a reference to each SiteMapNode based on the value of the SiteMapNode::Key property. By default, the XmlSiteMapProvider generates GUIDs for instances of the SiteMapNode class that do not have a value for the SiteMapNode::Url property. Custom site map provider implementers must provide their own mechanism for generating unique values of the SiteMapNode::Key property in the event that an instance of the SiteMapNode class does not have a value for the SiteMapNode::Url property.

The SiteMapProvider and XmlSiteMapProvider classes, which are the default site map provider implementation for ASP.NET, use the URL of a SiteMapNode object as a key in the various collections that the classes maintain.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: