SiteMapProvider.RootNode Property

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 virtual SiteMapNode RootNode { get; }
/** @property */
public SiteMapNode get_RootNode ()

public function get RootNode () : SiteMapNode

Not applicable.

Property Value

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 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;
  }
}

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Show: