Export (0) Print
Expand All

StaticSiteMapProvider.AddNode Method (SiteMapNode, SiteMapNode)

Adds a SiteMapNode to the collections that are maintained by the site map provider and establishes a parent/child relationship between the SiteMapNode objects.

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

protected internal override void AddNode(
	SiteMapNode node,
	SiteMapNode parentNode
)

Parameters

node
Type: System.Web.SiteMapNode

The SiteMapNode to add to the site map provider.

parentNode
Type: System.Web.SiteMapNode

The SiteMapNode under which to add node.

ExceptionCondition
ArgumentNullException

node is null.

InvalidOperationException

The SiteMapNode.Url or SiteMapNode.Key is already registered with the StaticSiteMapProvider. A site map node must be made up of pages with unique URLs or keys.

The site map node that is identified by the node parameter is added to an internal collection and a parent-child relationship is created between it and the site map node that is identified by the parentNode parameter.

The URL for a site map node might be interpreted when it is added to the internal collections. Application-relative and relative URLs are expanded to application-absolute virtual paths, which are then used internally to store and access the individual instances of the SiteMapNode class. Other URLs, such as physical paths, paths with protocols in them, and UNC paths, are not interpreted.

The XmlSiteMapProvider class, which is derived from the StaticSiteMapProvider class, and is the default site map provider for ASP.NET, uses the Url property of a SiteMapNode object as a lookup key in its internal collections, by default. If the Url property of the SiteMapNode is set, it must be unique within the scope of the site map provider. The FindSiteMapNode method attempts to retrieve site map nodes based on their Url property. Otherwise, you can use the Key property and the corresponding FindSiteMapNodeFromKey method to retrieve site map nodes. If no Url or Key is specified, the site map provider automatically generates a Key to track the site map nodes.

Notes to Inheritors

When overriding the AddNode method, ensure that the Key property is set to a unique value when adding the site map node using the AddNode method.

.NET Framework

Supported in: 4.5.2, 4.5.1, 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