Creating a Site Navigation Hierarchy
What's New in 2.0
- Site Navigation Provider - The site navigation provider in ASP.NET 2.0 exposes navigation information to pages in your application, allowing you to define the structure of your site separately from the actual physical layout of pages. The default site navigation provider is XML-based, but you may also expose this information from any backend by writing a custom provider for your site map.
- Site Navigation API - The site navigation API provides access to site navigation information from code in your application, abstracting away the details about where navigation information in stored. You can use the API to programmatically traverse the navigation nodes of your application.
- Navigation Controls - The navigation controls provide common UI for navigating between pages in your site, such as treeviews, menus, and breadcrumbs. These controls use the site navigation service in ASP.NET 2.0 to retrieve the custom structure you have defined for your site. The SiteMapDataSource control also enables you to bind other UI controls to site navigation data.
This section discusses these and other navigation features in ASP.NET 2.0.
Websites frequently need to display navigation data that guides users through a site. The navigation features of ASP.NET allow developers to easily define navigation
data and display UI based upon this information.
The Site Navigation API is a provider-based programming abstraction
for accessing site navigation data. The API stores navigation data in an XML file, and exposes this data as a set of SiteMapNode classes. Application
and control developers can consume SiteMapNode instances and use this information to render navigation UI.
Navigation-oriented server controls include the Menu, TreeView, SiteMapPath and SiteMapDataSource controls. These controls are built on top of the Site Navigation classes
and consume and display navigation data without being aware of data-store specific storage issues. The Menu and Treeview controls can also consume data
from XML files and from the XMLDataSource control.
The Url mapping feature allows developers to define simple rules for re-mapping incoming requests to different URLs.