Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Add Method (SiteMapProvider)
Collapse the table of content
Expand the table of content

SiteMapProviderCollection.Add Method (SiteMapProvider)

Adds a SiteMapProvider object to the provider collection using the Name property as the key.

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

public void Add(
	SiteMapProvider provider
)

Parameters

provider
Type: System.Web.SiteMapProvider
The SiteMapProvider to add.

ExceptionCondition
ArgumentNullException

provider is null.

NotSupportedException

The SiteMapProviderCollection is read-only.

ArgumentException

A SiteMapProvider with the same name already exists in the SiteMapProviderCollection.

The SiteMapProviderCollection object that is returned by the Providers property is read-only. For this reason, you cannot use the Add and AddArray methods to programmatically add additional providers to the SiteMap at run time. Therefore, the Add and AddArray methods are used only in scenarios where you manually create site map provider objects and manage them with an instance of the SiteMapProviderCollection class. Use the Add method when you want to add a single SiteMapProvider to the SiteMapProviderCollection.

Because the SiteMap class is static, any SiteMapProvider contained in its Providers collection remains for the lifetime of the Web application.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Community Additions

ADD
Show:
© 2015 Microsoft