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)
Thetype exposes the following members.
|CurrentNode||Gets the SiteMapNode object that represents the currently requested page.|
|Description||Gets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs). (Inherited from ProviderBase.)|
|EnableLocalization||Gets or sets a Boolean value indicating whether localized values of SiteMapNode attributes are returned.|
|Name||Gets the friendly name used to refer to the provider during configuration. (Inherited from ProviderBase.)|
|ParentProvider||Gets or sets the parent object of the current provider.|
|ResourceKey||Get or sets the resource key that is used for localizing SiteMapNode attributes.|
|RootNode||Gets the root SiteMapNode object of the site map data that the current provider represents.|
|RootProvider||Gets the root object in the current provider hierarchy.|
|SecurityTrimmingEnabled||Gets a Boolean value indicating whether a site map provider filters site map nodes based on a user's role.|
|AddNode(SiteMapNode)||Adds a SiteMapNode object to the node collection that is maintained by the site map provider.|
|AddNode(SiteMapNode, SiteMapNode)||Adds a SiteMapNode object to the node collection that is maintained by the site map provider and specifies the parent SiteMapNode object.|
|Equals(Object)||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)|
|FindSiteMapNode(HttpContext)||Retrieves a SiteMapNode object that represents the currently requested page using the specified HttpContext object.|
|FindSiteMapNode(String)||When overridden in a derived class, retrieves a SiteMapNode object that represents the page at the specified URL.|
|FindSiteMapNodeFromKey||Retrieves a SiteMapNode object based on a specified key.|
|GetChildNodes||When overridden in a derived class, retrieves the child nodes of a specific SiteMapNode.|
|GetCurrentNodeAndHintAncestorNodes||Provides an optimized lookup method for site map providers when retrieving the node for the currently requested page and fetching the parent and ancestor site map nodes for the current page.|
|GetCurrentNodeAndHintNeighborhoodNodes||Provides an optimized lookup method for site map providers when retrieving the node for the currently requested page and fetching the site map nodes in the proximity of the current node.|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetParentNode||When overridden in a derived class, retrieves the parent node of a specific SiteMapNode object.|
|GetParentNodeRelativeToCurrentNodeAndHintDownFromParent||Provides an optimized lookup method for site map providers when retrieving an ancestor node for the currently requested page and fetching the descendant nodes for the ancestor.|
|GetParentNodeRelativeToNodeAndHintDownFromParent||Provides an optimized lookup method for site map providers when retrieving an ancestor node for the specified SiteMapNode object and fetching its child nodes.|
|GetRootNodeCore||When overridden in a derived class, retrieves the root node of all the nodes that are currently managed by the current provider.|
|GetRootNodeCoreFromProvider||Retrieves the root node of all the nodes that are currently managed by the specified site map provider.|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|HintAncestorNodes||Provides a method that site map providers can override to perform an optimized retrieval of one or more levels of parent and ancestor nodes, relative to the specified SiteMapNode object.|
|HintNeighborhoodNodes||Provides a method that site map providers can override to perform an optimized retrieval of nodes found in the proximity of the specified node.|
|Initialize||Initializes the implementation, including any resources that are needed to load site map data from persistent storage. (Overrides ProviderBase.Initialize(String, NameValueCollection).)|
|IsAccessibleToUser||Retrieves a Boolean value indicating whether the specified SiteMapNode object can be viewed by the user in the specified context.|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|RemoveNode||Removes the specified SiteMapNode object from the node collection that is maintained by the site map provider.|
|ResolveSiteMapNode||Raises the SiteMapResolve event.|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
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 code example demonstrates 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 that follows an expected structure to load 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. An example of a file that meets these criteria is shown below.
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 SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.