System.Web
2.0.0.0
System.Web.StaticSiteMapProvider
System.IDisposable
The class loads site map data from an XML file that follows a known schema. The site map data is bounded by <siteMap> tags and consists of nested <siteMapNode> tags. Two constraints are imposed by the and classes on the structure of the site map data:
-
Only one root node can exist.
-
For objects that specify URLs, the URLs must be unique within the scope of the provider. (For nodes that do not specify URLs, all keys must be unique.)
The following code example shows an example of an XML file that can be used with the .
<siteMap>
<siteMapNode title="RootNode" description="This is the root node of the site map. There can be only one root node." url="Page1.aspx" >
<siteMapNode title="ChildofRootNode" description="Descriptions do not have to be unique." url="Page2.aspx">
<siteMapNode title="ChildOfChildNode" description="SiteMapNode objects can be nested to any level." url="Page3.aspx"/>
</siteMapNode>
<siteMapNode title="ChildofRootNode" description="Descriptions do not have to be unique." url="Page4.aspx"/>
</siteMapNode>
</siteMap>
The is the default provider for ASP.NET and it reads XML data from a file named Web.sitemap that is located within the directory structure of the ASP.NET application. By default, the Web.sitemap file is located at the application root; however, if you want to change the name or location of the file from which the loads data, you can override the default configuration in your Web.config file. By overriding the default configuration settings in your Web.config file, you can tailor the behavior of the for each ASP.NET application, as necessary.
The following code example demonstrates an example Web.config file, where the is still used, but a different site map file is used. Because all providers in a object must be named uniquely, the one that is specified in the Web.config file uses a name other than the default but is also set as the default provider so that it will be used instead of the that is specified in the default ASP.NET configuration.
You can change the name of the site navigation data file, but you cannot change its extension. The only reads data from files that are named with the file name extension .sitemap.
<siteMap defaultProvider="MyXmlSiteMapProvider" enabled="true">
<providers>
<add name="MyXmlSiteMapProvider"
description="SiteMap provider that reads in .sitemap files."
type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
siteMapFile="CustomWeb.sitemap" />
</providers>
</siteMap>
The class is derived from the class and is the default site map provider for ASP.NET. The class generates site map trees from XML files with the file name extension .sitemap.
Constructor
To be added.
Creates a new, unnamed, instance of the class.
2.0.0.0
Method
2.0.0.0
System.Void
The parameter is added to an internal collection, and a parent/child relationship is created between it and .
The class, derived from the class and the default site map provider for ASP.NET, uses the property of a object as a lookup key in its internal collections, by default. If the property of the is set, it must be unique within the scope of the provider. The method attempts to retrieve nodes based on their . Otherwise, you can use the property, and the corresponding method, to retrieve nodes.
Adds a object to the collections that are maintained by the current provider.
The to add to the provider.
The under which to add .
Method
System.Void
The method links to the current provider as a child of the current provider. The root node of is added to the hierarchy for the current provider as a child node of . Because the parent provider calls the method on , the exceptions that are described in the method might be thrown.
Links a child site map provider to the current provider.
The name of one of the objects currently registered in the .
A site map node of the current site map provider under which the root node and all nodes of the child provider is added.
2.0.0.0
Method
System.Web.SiteMapNode
The method is called to load and build the site map from persistent storage.
For the default behavior when security trimming is enabled, see "Remarks" in .
After the object parses and loads site map data, all loaded objects and collections are made read-only. When the parses the property from a site map file, it converts application-relative URLs, as well as relative URLs, to application-absolute virtual paths.
The subscribes to file change notifications for the .sitemap file. If any change is made to the .sitemap file, the is reloaded, and the site map structure is rebuilt.
Loads the site map information from an XML file and builds it in memory.
Returns the root of the site map navigation structure.
2.0.0.0
Method
System.Void
The class overrides the inherited method to provide additional state cleanup beyond the basic implementation, including clearing its child provider tracking and the property tracking mechanisms.
Removes all elements in the collections of child and parent site map nodes and site map providers that the object internally tracks as part of its state.
2.0.0.0
Method
System.Void
The class implements the method of the interface to release its associated file monitor when the site map file is unloaded from memory. This overload of the method calls the overload that takes a parameter and sets the value to true.
Notifies the file monitor of the Web.sitemap file that the object no longer requires the file to be monitored.
2.0.0.0
Method
System.Void
The method returns true if the method is called by user code. Otherwise it returns false, if the method is called by the finalizer thread during run time.
Notifies the file monitor of the Web.sitemap file that the object no longer requires the file to be monitored. The method takes a Boolean parameter indicating whether the method is called by user code.
true to release both managed and unmanaged resources; false to release only unmanaged resources.
2.0.0.0
Method
System.Web.SiteMapNode
The object overrides the method to ensure that any linked child providers are searched for the node if the implementation of the base class does not return a node for the specified URL.
The parameter should be either an absolute virtual path or an application-relative path, depending on how it is specified in the XML site map data file.
The class and classes that are derived from it use the URL of a object as a key in the various collections that the class maintains. Therefore, these URLs must be unique within the scope of the site map. If the URL is not found within the immediate site map data that is managed by the , it calls the on each child provider that is linked to it through the provider attribute of its site map nodes.
The method indirectly calls the method to retrieve the top-level node in the site map. Therefore, any exceptions that occur for the method can also occur when calling the method.
Retrieves a object that represents the page at the specified URL.
A that represents the page identified by .
A URL that identifies the page for which to retrieve a .
2.0.0.0
Method
System.Web.SiteMapNode
The class overrides the method to ensure that any linked child providers are searched for the node, if the implementation for the base class does not return a node for .
The object, derived from the class and the default site map provider for ASP.NET, uses the property of a object as a lookup key in its internal collections, by default. If the property of the is set, it must be unique within the scope of the provider. If no is specified, the automatically generates a to track the nodes.
The method might call the method on any child providers that are associated with the current provider. Therefore, the exceptions that are described in the method might be thrown.
Retrieves a object based on a specified key.
A that represents the page identified by ; otherwise, null, if security trimming is enabled and the node cannot be shown to the current user or the node is not found by in the node collection.
A lookup key with which to search for a .
2.0.0.0
Method
2.0.0.0
System.Web.SiteMapNode
The method calls the method to retrieve the top-level node in the site map. Therefore, any exceptions that occur for the method can also occur when calling the method.
Retrieves the top-level node of the current site map data structure.
A that represents the top-level node in the current site map data structure.
Method
System.Void
The class overrides the inherited method to apply several attributes, such as the siteMapFile and description attributes, to the collection.
Initializes the object. The method does not actually build a site map, it only prepares the state of the to do so.
The to initialize.
A that can contain additional attributes to help initialize . These attributes are read from the configuration in the Web.config file.
2.0.0.0
Method
System.Void
To be added.
Removes the specified object from all node collections that are tracked by the provider.
The node to remove from the node collections.
2.0.0.0
Method
System.Void
The method removes from the hierarchy for the current provider, including any parent/child relationships that are established by the method between site map nodes of the current provider and the removed provider.
Removes a linked child site map provider from the hierarchy for the current provider.
The name of one of the objects currently registered in the .
2.0.0.0
Property
System.Web.SiteMapNode
To be added.
The property calls the method to retrieve the top-level node in the site map. Therefore, any exceptions that occur for the method can also occur when accessing the property.
The and classes permit only one root object in a site map. The class overrides the abstract property and provides a simple implementation to track the root node.
Gets the root node of the site map.
2.0.0.0