Preferred Language:
Listing 20.5 - Global.asax
<%@ Application Language="C#" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
void Application_Start(Object sender, EventArgs e)
{
SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(SiteMap_SiteMapResolve);
}
SiteMapNode SiteMap_SiteMapResolve(object sender, SiteMapResolveEventArgs e)
{
if (SiteMap.CurrentNode == null)
{
string url = e.Context.Request.Path;
string title = Path.GetFileNameWithoutExtension(url);
SiteMapNode newNode = new SiteMapNode(e.Provider, url, url, title);
newNode.ParentNode = SiteMap.RootNode;
return newNode;
}
return SiteMap.CurrentNode;
}
</script>
Need ASP.NET and Visual Studio 2008 Training?
- Learn ASP.NET 3.5 from Stephen Walther, author of ASP.NET 3.5 Unleashed.
We've provided ASP.NET training for NASA, Lockheed Martin, the National Science Foundation, Verizon,
Boeing, the US House of Representatives, Kaiser, Petco, Mary Kay, and Microsoft.
Why not your company?
-
Receive a four day, hands-on, intensive workshop.
-
We fly to you, anywhere in the world.
-
We can bring our own laptops.
To learn more, visit the
Superexpert Training website.