Assembly: System.Web (in system.web.dll)
A SiteMapNode object represents a Web site page in a site map structure. SiteMapNode objects are loaded by the static SiteMap class at run time using one or more site map providers to load site map data from persistent storage into memory. SiteMapNode objects are wrapped by the SiteMapNodeItem class for use by Web server controls, such as the SiteMapPath control.
The SiteMapNode class includes several properties that are used to describe a single page in a Web site, including properties that describe a page, such as the Url, Title, and Description properties. Whereas the Url property is used by the XmlSiteMapProvider class, which is the default site map provider for ASP.NET, as a lookup key in the internal collections that the provider uses to track nodes, the SiteMapNode class supports a basic Key property that can be used by site map providers to track nodes. Additionally, the Url property is used by navigation controls to render hyperlinks to pages within a navigation structure. The Title property is a friendly name for the SiteMapNode, is often the same as the HTML title of a Web Form, and is used by navigation controls to render simple labels. Finally, a NameValueCollection collection of additional Attributes attributes is available to site map providers that use SiteMapNode objects, but require additional properties that are not available in the base SiteMapNode class.
This section contains two code examples. The first code example demonstrates how to create a new site map node collection and add elements to it. The second code example demonstrates how to load site map data from a text file.
The following code example demonstrates how the SimpleTextSiteMapProvider parses a text file that contains site map data in comma-delimited strings. A new SiteMapNode object is added to the internal tracking collections of the class for each line that is read from the file.
This code example is part of a larger example provided for the SiteMapProvider class.