Programming Microsoft ASP.NET 4 - Dino Esposito [188]
Table 8-4 lists the feasible attributes of the Table 8-4. Attributes of the Attribute Description description Defines the text used to describe the page. This text is used to add a ToolTip to the page link in a SiteMapPath control (discussed later) and as documentation. provider String that indicates the site map provider to use to fill the current node. resourceKey Indicates the name of the resource key used to localize a given node of the site map. roles String that indicates the roles that users must have to view this page. siteMapFile Indicates the name of the site map file to use to fill the current node. title Defines the text used as the text of the link to the page. url Defines the URL of the page. The roles attribute is key to implementing a feature known as security trimming. Security trimming essentially refers to the site map API capability of preventing unauthorized users from viewing pages that require a particular role. In addition to using the attributes listed in Table 8-4, you can use custom attributes too. You cannot use custom nodes. A .sitemap file can contain only Site Map Providers Note that you can optionally use multiple providers at the same time. For example, by setting the provider attribute on a ... The additional provider must be registered in the configuration file and feature all information needed to connect to its own data source. Here’s an example for the sample text file provider: siteMapFile="MySiteMap.txt" /> The Creating the map of a site is only the first step. Once it is created, in fact, this information must be easily and programmatically accessible. Although most of the time you consume site information through a bunch of ad hoc controls, it’s useful to take a look at the class that acts as the official container of site map information—the SiteMap class. When an ASP.NET application runs, the site map structure is exposed through a global instance of the SiteMap class. The SiteMap Class
The site navigation subsystem is provider based, meaning that you can use custom providers to define some site map contents. A custom site map provider reads information from a different storage medium, be it another XML file with a distinct schema, a text file or, perhaps, a database. A custom site map provider is a class that inherits from SiteMapProvider or, better yet, from an intermediate class named StaticSiteMapProvider.
Defined in the System.Web assembly and namespace, the SiteMap class has only static members. It exposes a