System.Web.SiteMapProviderCollection.Add Method

Adds a System.Web.SiteMapProvider to the provider collection using the System.Configuration.Provider.ProviderBase.Name property as the key.

Syntax

public override void Add (System.Configuration.Provider.ProviderBase provider)

Parameters

provider
The System.Web.SiteMapProvider to add.

Remarks

The System.Web.SiteMapProviderCollection object that is returned by the SiteMap.Providers property is read-only. For this reason, you cannot use the erload:System.Web.SiteMapProviderCollection.Add and SiteMapProviderCollection.AddArray(SiteMapProvider[]) methods to add additional providers programmatically at run time. Therefore, the erload:System.Web.SiteMapProviderCollection.Add and SiteMapProviderCollection.AddArray(SiteMapProvider[]) methods are used only in scenarios where you manually create site map provider objects and manage them with an instance of the System.Web.SiteMapProviderCollection class. The SiteMapProviderCollection.Add(System.Configuration.Provider.ProviderBase) method checks the type of the specified provider, and then calls the SiteMapProviderCollection.Add(SiteMapProvider) method to add it to the collection.

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

Requirements

Namespace: System.Web
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0