SiteMapProvider.RootNode Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the root SiteMapNode object of the site map data that the current provider represents.

Namespace:   System.Web
Assembly:  System.Web (in System.Web.dll)

Public Overridable ReadOnly Property RootNode As SiteMapNode

Property Value

Type: System.Web.SiteMapNode

The root SiteMapNode of the current site map data provider. The default implementation performs security trimming on the returned node.

The default implementation calls the abstract GetRootNodeCore method.

Notes to Inheritors:

When overriding the RootNode property in a derived class, be sure that the implementation does not navigate the provider hierarchy, if one exists, to find the absolute root node of the site.

The following code example demonstrates how to implement the RootNode property in a class that implements the abstract SiteMapProvider class.

This code example is part of a larger example provided for the SiteMapProvider class.

' 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

.NET Framework
Available since 2.0
Return to top
Show: