SiteMapProvider.RootNode プロパティ

定義

現在のプロバイダーが示すサイト マップ データのルート SiteMapNode オブジェクトを取得します。

public:
 virtual property System::Web::SiteMapNode ^ RootNode { System::Web::SiteMapNode ^ get(); };
public virtual System.Web.SiteMapNode RootNode { get; }
member this.RootNode : System.Web.SiteMapNode
Public Overridable ReadOnly Property RootNode As SiteMapNode

プロパティ値

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 場合は、実装がプロバイダー階層 (存在する場合) を移動してサイトの絶対ルート ノードを見つけないようにしてください。

適用対象

こちらもご覧ください