SiteMapProvider.RootNode 属性    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取当前提供程序表示的站点地图数据的根 SiteMapNode 对象。
public:
 virtual property System::Web::SiteMapNode ^ RootNode { System::Web::SiteMapNode ^ get(); };public virtual System.Web.SiteMapNode RootNode { get; }member this.RootNode : System.Web.SiteMapNodePublic Overridable ReadOnly Property RootNode As SiteMapNode属性值
当前站点地图数据提供程序的根 SiteMapNode。 默认的实现在被返回的节点上执行安全修整。
示例
下面的代码示例演示如何在实现抽象SiteMapProvider类的类中实现RootNode属性。
此代码示例是为类提供的大型示例的 SiteMapProvider 一部分。
// Implement the CurrentNode property.
public override SiteMapNode CurrentNode
{
  get
  {
    string currentUrl = FindCurrentUrl();
    // Find the SiteMapNode that represents the current page.
    SiteMapNode currentNode = FindSiteMapNode(currentUrl);
    return currentNode;
  }
}
// Implement the RootNode property.
public override SiteMapNode RootNode
{
  get
  {
    return rootNode;
  }
}
' Implement the CurrentNode property.
Public Overrides ReadOnly Property CurrentNode() As SiteMapNode
  Get
    Dim currentUrl As String = FindCurrentUrl()
    ' Find the SiteMapNode that represents the current page.
    Dim aCurrentNode As SiteMapNode = FindSiteMapNode(currentUrl)
    Return aCurrentNode
  End Get
End Property
' Implement the RootNode property.
Public Overrides ReadOnly Property RootNode() As SiteMapNode
  Get
    Return aRootNode
  End Get
End Property
注解
默认实现调用抽象 GetRootNodeCore 方法。
继承者说明
重写 RootNode 派生类中的属性时,请确保实现不导航提供程序层次结构(如果存在)以查找站点的绝对根节点。