XmlSiteMapProvider.FindSiteMapNode(String) 方法


擷取 SiteMapNode 物件,其代表位於指定 URL 的頁面。Retrieves a SiteMapNode object that represents the page at the specified URL.

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



URL,其可識別要擷取 SiteMapNode 的頁面。A URL that identifies the page for which to retrieve a SiteMapNode.



SiteMapNode,其代表 rawURL 所識別的頁面。A SiteMapNode that represents the page identified by rawURL.


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


XmlSiteMapProvider物件會覆寫 FindSiteMapNode 方法,以確保在基類的執行不會傳回指定之 URL 的節點時,會搜尋節點的任何連結子提供者。The XmlSiteMapProvider object overrides the FindSiteMapNode method to ensure that any linked child providers are searched for the node if the implementation of the base class does not return a node for the specified URL.

rawUrl參數應該是絕對虛擬路徑或應用程式相對路徑,視在 XML 網站地圖資料檔案中的指定方式而定。The rawUrl parameter should be either an absolute virtual path or an application-relative path, depending on how it is specified in the XML site map data file.

XmlSiteMapProvider衍生自它的類別和類別,會使用物件的 URL SiteMapNode 做為類別所維護之各種集合中的索引鍵。The XmlSiteMapProvider class and classes that are derived from it use the URL of a SiteMapNode object as a key in the various collections that the class maintains. 因此,這些 Url 在網站地圖的範圍內必須是唯一的。Therefore, these URLs must be unique within the scope of the site map. 如果在所管理的直屬網站地圖資料內找不到 URL XmlSiteMapProvider ,它會 FindSiteMapNode 透過 provider 其網站地圖節點的屬性,在連結到它的每個子提供者上呼叫。If the URL is not found within the immediate site map data that is managed by the XmlSiteMapProvider, it calls the FindSiteMapNode on each child provider that is linked to it through the provider attribute of its site map nodes.

FindSiteMapNode方法會間接呼叫 BuildSiteMap 方法,以抓取網站地圖中的最上層節點。The FindSiteMapNode method indirectly calls the BuildSiteMap method to retrieve the top-level node in the site map. 因此,在呼叫方法時,也會發生任何針對方法所發生的例外狀況 BuildSiteMap FindSiteMapNodeTherefore, any exceptions that occur for the BuildSiteMap method can also occur when calling the FindSiteMapNode method.