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 SiteMap objects.
Assembly: System.Web (in System.Web.dll)
The StaticSiteMapProvider and XmlSiteMapProvider classes represent the default implementations of the abstract class. The 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 class supports the concept of a site map provider hierarchy, by declaring the RootProvider and ParentProvider properties. A 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 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 SiteMap object, which keeps track of all the providers that are available to it through its 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>"> <providers> <add name="<friendly name>" type="<fully qualified class name>, <assembly name (optional)>" siteMapFile = "<file name>" /> </providers> </siteMap>
The site navigation data that is loaded by these providers is used by other components of the site map infrastructure, such as the SiteMapPath and 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.Notes to Inheritors:
The following example shows how to write a class that implements the abstract class. This example includes only a sample and a sample text file that works with it. To run the example you also need an entry in the Web.config file and an .aspx page. You can find these in the documentation for the SiteMapDataSource.SiteMapProvider property.
The example uses a comma-delimited file to define sitemap information. The first line of the file represents the root node of the sitemap, and subsequent lines are subnodes. Each subnode identifies its parent node by URL. The following example shows this format.
default.aspx,Home,MyCompany Home Page, sale.aspx,Now On Sale,Check Out These Great Deals!,default.aspx catalog.aspx,Online Catalog,Browse Our Many Great Items!,default.aspx
The SimpleTextSiteMapProvider provides example implementations of all the properties and methods.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.