System.Web.SiteMapProvider Class

Provides a common base class for all site map data providers, and a way for developers to implement custom site map data providers that can be used with the ASP.NET site map infrastructure as persistent stores for System.Web.SiteMap objects.

See Also: SiteMapProvider Members


public abstract class SiteMapProvider : System.Configuration.Provider.ProviderBase


The System.Web.StaticSiteMapProvider and System.Web.XmlSiteMapProvider classes represent the default implementations of the abstract System.Web.SiteMapProvider class. The System.Web.XmlSiteMapProvider uses an XML file named Web.sitemap to store site map data. For more information on about the Web.sitemap file, see ASP.NET Site Maps.

The System.Web.SiteMapProvider class supports the concept of a site map provider hierarchy, by declaring the SiteMapProvider.RootProvider and SiteMapProvider.ParentProvider properties. A System.Web.SiteMapProvider can be a child or parent of another provider. This enables scenarios where different content areas of a site are owned or implemented by different development groups that maintain their own site maps and site map providers.

All System.Web.SiteMapProvider objects are configured in the Web.config files. Any site map providers that are declared in these configuration files are loaded at run time and are used to load and process site navigation data. The System.Web.SiteMap object, which keeps track of all the providers that are available to it through its SiteMap.Providers property collection, provides programmatic access to the navigation data that is managed by the providers. The following code example demonstrates the format that is used to declare a site map provider in a Web.config file.


<siteMap defaultProvider="<name>">
      name="<friendly name>"
      type="<fully qualified class name>, <assembly name (optional)>" 
      siteMapFile = "<file name>" />

The site navigation data that is loaded by these providers is used by other components of the site map infrastructure, such as the System.Web.UI.WebControls.SiteMapPath and System.Web.UI.WebControls.TreeView controls, to display site map information for users.

If you implement your own site map provider, you can place the source file in the App_Code directory of your ASP.NET application, and then the assembly will be compiled automatically. You can also place your own site map provider in the Global Assembly Cache (GAC), and provide a fully-qualified reference to it in the Web.config file. For more information on compiler services, see Working with Assemblies and the Global Assembly Cache.


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