System.Web.SiteMap Class

The System.Web.SiteMap class is an in-memory representation of the navigation structure for a site, which is provided by one or more site map providers. This class cannot be inherited.

See Also: SiteMap Members

Syntax

public static class SiteMap

Remarks

Site maps are used in conjunction with the System.Web.UI.WebControls.SiteMapDataSource, System.Web.UI.WebControls.SiteMapPath, and other controls to render an effective navigation interface for users to navigate a Web site. A System.Web.SiteMap object is a component of the ASP.NET site navigation infrastructure that provides access to read-only site map information for page and control developers using navigation and System.Web.UI.WebControls.SiteMapDataSource controls. Other components of the ASP.NET site navigation infrastructure include the System.Web.SiteMapProvider and System.Web.XmlSiteMapProvider classes, the Web.sitemap file, and the various controls that work with the System.Web.SiteMap class, such as the System.Web.UI.WebControls.SiteMapPath control, to render content and menus.

The System.Web.SiteMap has several functions:

Fundamentally, the System.Web.SiteMap is a container for a hierarchical collection of System.Web.SiteMapNode objects. However, the System.Web.SiteMap does not maintain the relationships between the nodes; rather, it delegates this to the site map providers. The System.Web.SiteMap acts as an interface to the site navigation information (in the form of System.Web.SiteMapNode objects) that is held by these site map providers. It keeps track of the providers from which it can access site navigation data and exposes its SiteMap.Providers collection. A provider can store its site map information in any way—as long as it extends the System.Web.SiteMapProvider abstract class, the System.Web.SiteMap class can be initialized successfully from it.

The default provider for the System.Web.SiteMap class is the System.Web.XmlSiteMapProvider class, which works with an XML configuration file, Web.sitemap. However, you can write your own System.Web.SiteMapProvider object, and use it to initialize the site map for your site. For an example of a custom site map provider, see System.Web.SiteMapProvider.

A default site map configuration is specified that manages the site navigation configuration. You can override this configuration in the Web.config file, should you choose to write your own site map provider.

The System.Web.SiteMap class offers only static members for performance and it can be accessed at any time in a given site from a Web Form or Web server control.

Requirements

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