Export (0) Print
Expand All

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft