AddNode Method (SiteMapNode, SiteMapNode)
Collapse the table of content
Expand the table of content

XmlSiteMapProvider.AddNode Method (SiteMapNode, SiteMapNode)

Adds a SiteMapNode object to the collections that are maintained by the current provider.

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

protected internal override void AddNode (
	SiteMapNode node,
	SiteMapNode parentNode
protected void AddNode (
	SiteMapNode node, 
	SiteMapNode parentNode
protected internal override function AddNode (
	node : SiteMapNode, 
	parentNode : SiteMapNode
Not applicable.



The SiteMapNode to add to the provider.


The SiteMapNode under which to add node.

Exception typeCondition


node or parentNode is a null reference (Nothing in Visual Basic).


The current XmlSiteMapProvider is not the provider associated with node.


A node with the same URL or key is already registered with the XmlSiteMapProvider. - or -

A duplicate site map node has been encountered programmatically, such as when linking two site map providers.

- or -

node is the root node of the XmlSiteMapProvider.

The node parameter is added to an internal collection, and a parent/child relationship is created between it and parentNode.

The XmlSiteMapProvider class, derived from the StaticSiteMapProvider class and 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 provider. The FindSiteMapNode method attempts to retrieve nodes based on their Url. Otherwise, you can use the Key property, and the corresponding FindSiteMapNodeFromKey method, to retrieve nodes.

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

Community Additions

© 2015 Microsoft