Retrieves a System.Web.SiteMapNode object based on a specified key.
- key
- A lookup key with which a System.Web.SiteMapNode is created.
A System.Web.SiteMapNode that represents the page identified by key; otherwise, null, 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 StaticSiteMapProvider.FindSiteMapNodeFromKey(string) method retrieves a site map node from an internal Hashtable object based on key.
The System.Web.XmlSiteMapProvider object, which is derived from the System.Web.StaticSiteMapProvider class and is the default site map provider for ASP.NET, uses the SiteMapNode.Url property of a System.Web.SiteMapNode object as a lookup key in its internal collections, by default. If the SiteMapNode.Url property of the System.Web.SiteMapNode is set, it must be unique within the scope of the site map provider. The StaticSiteMapProvider.FindSiteMapNode(string) method attempts to retrieve site map nodes based on their SiteMapNode.Url. Otherwise, you can use the SiteMapNode.Key property and the corresponding StaticSiteMapProvider.FindSiteMapNodeFromKey(string) method to retrieve site map nodes.
The System.Web.StaticSiteMapProvider has a default implementation that looks up instances of the System.Web.SiteMapNode class based on the key parameter. If a site map provider implementer used the erload:System.Web.StaticSiteMapProvider.AddNode method, the System.Web.StaticSiteMapProvider already will have stored a reference to each System.Web.SiteMapNode based on the value of the SiteMapNode.Key property. By default, the System.Web.XmlSiteMapProvider generates GUIDs for instances of the System.Web.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 System.Web.SiteMapNode class does not have a value for the SiteMapNode.Url property.
The System.Web.SiteMapProvider and System.Web.XmlSiteMapProvider classes, which are the default site map provider implementation for ASP.NET, use the URL of a System.Web.SiteMapNode object as a key in the various collections that the classes maintain.