ASP.NET site navigation provides several Web server controls that display a navigation structure on a Web page: the
Alternatively, you can implement your own site-map provider. Three primary reasons for creating a custom site-map provider are as follows:
-
To store site-map information in a data source that is not supported by the ASP.NET default site-map provider. For example, you might want to store your site-map data in a Visual FoxPro database, an Oracle database, or other data source.
-
To manage navigation information using a schema that is different from the schema used for the Web.sitemap file. For example, you might have an existing implementation for storing site-map data.
-
To use a dynamic site-map structure. For example, you might want each client account to be able to view a different site map.
![]() |
---|
Implementing a custom site-map provider that stores site-map data in a file with a file name extension other than .sitemap is a potential security risk. By default, ASP.NET is configured to protect files with known file name extensions — such as .sitemap — from being downloaded by a client. To help protect your data, place any custom site-map data files that have a file name extension other than .sitemap in the App_Data folder. For more information, see Securing ASP.NET Site Navigation. |
Required Classes
To implement a site-map provider, create a class that inherits the
![]() |
---|
The SiteMapProvider class imposes one constraint on the structure of the site-map data: only one root node can exist. The implementation of the default ASP.NET site-map provider also specifies that URLs must be unique within the scope of the provider, but custom site-map providers do not have this limitation. |
Required SiteMapProvider Members
The following table lists the only methods that are required to implement a custom site-map provider. The SiteMapProvider base class provides a minimal implementation.
Method | Description |
---|---|
|
Retrieves an instance of the |
|
Retrieves the child nodes of a specific instance of the SiteMapNode class. |
|
Retrieves the parent node of a specific instance of the SiteMapNode class. |
|
Retrieves the root node of all the nodes that are managed by the current provider. This method is called internally by various site navigation classes to ensure that the navigation data has been loaded by the provider. This method must not return a null node. |
If you are satisfied with the semantics of the
Custom Members
You might need to extend the site-map provider interfaces with additional functionality that is not provided by the SiteMapProvider abstract classes. If the custom provider is configured to be the default provider and the return value of
See Also
Tasks
How to: Implement ASP.NET Site-Map ProvidersConcepts
ASP.NET Site Navigation OverviewASP.NET Site-Map Security Trimming
Securing ASP.NET Site Navigation
Securing Data Access