Adds a System.Web.SiteMapProvider object to the provider collection using the System.Configuration.Provider.ProviderBase.Name property as the key.
- provider
- The System.Web.SiteMapProvider to add.
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 programmatically add additional providers to the System.Web.SiteMap 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. Use the SiteMapProviderCollection.Add(SiteMapProvider) method when you want to add a single System.Web.SiteMapProvider to the System.Web.SiteMapProviderCollection.
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.