This documentation is archived and is not being maintained.

SiteMapProviderCollection.Add Method (SiteMapProvider)

Note: This method is new in the .NET Framework version 2.0.

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
)
public void Add (
	SiteMapProvider provider
)
public function Add (
	provider : SiteMapProvider
)

Parameters

provider

The SiteMapProvider to add.

Exception typeCondition

ArgumentNullException

provider is a null reference (Nothing in Visual Basic).

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.

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

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

.NET Framework

Supported in: 2.0
Show: