XmlSiteMapProvider.FindSiteMapNodeFromKey(String) 方法


根據指定的索引鍵,擷取 SiteMapNode 物件。Retrieves a SiteMapNode object based on a specified key.

 override System::Web::SiteMapNode ^ FindSiteMapNodeFromKey(System::String ^ key);
public override System.Web.SiteMapNode FindSiteMapNodeFromKey (string key);
override this.FindSiteMapNodeFromKey : string -> System.Web.SiteMapNode
Public Overrides Function FindSiteMapNodeFromKey (key As String) As SiteMapNode



查閱索引鍵,用於搜尋 SiteMapNodeA lookup key with which to search for a SiteMapNode.



代表 key 所識別之頁面的 SiteMapNode;如果安全性調整已啟用,因此目前使用者看不到該節點,或使用 key 在節點集合中找不到該節點,則為 nullA SiteMapNode that represents the page identified by key; otherwise, null, if security trimming is enabled and the node cannot be shown to the current user or the node is not found by key in the node collection.


連結至目前網站地圖提供者的子提供者傳回無效的節點。A child provider linked to the current site map provider returned a node that is not valid.


XmlSiteMapProvider類別會覆寫 FindSiteMapNodeFromKey 方法,以確保搜尋節點的任何連結子提供者(如果基類的執行不會傳回的節點) keyThe XmlSiteMapProvider class overrides the FindSiteMapNodeFromKey method to ensure that any linked child providers are searched for the node, if the implementation for the base class does not return a node for key.

XmlSiteMapProvider衍生自類別的物件 StaticSiteMapProvider 和 ASP.NET 的預設網站地圖提供者, Url 預設會 SiteMapNode 在其內部集合中使用物件的屬性做為查閱索引鍵。The XmlSiteMapProvider object, derived from the StaticSiteMapProvider class and 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. 如果 Url 設定的屬性 SiteMapNode ,則在提供者的範圍內必須是唯一的。If the Url property of the SiteMapNode is set, it must be unique within the scope of the provider. 如果未 Url 指定,則 XmlSiteMapProvider 會自動產生 Key 來追蹤節點。If no Url is specified, the XmlSiteMapProvider automatically generates a Key to track the nodes.

FindSiteMapNodeFromKey方法可能會 BuildSiteMap 在與目前提供者相關聯的任何子提供者上,呼叫方法。The FindSiteMapNodeFromKey method might call the BuildSiteMap method on any child providers that are associated with the current provider. 因此,可能會擲回方法中所述的例外狀況 BuildSiteMapTherefore, the exceptions that are described in the BuildSiteMap method might be thrown.