Click here to Skip to main content
15,121,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys!

I come with a problem while i am working with my site, programme ASP.NET4.0 with url routing.

The SiteMapPath Control(navigation, bind with Web.sitemap) display well when i visit,
but it does NOT display at all while I add a slash(/) at the url's end(url looks like
PS:the SiteMapPath is under the banner.

Web.sitemap tips:
<sitemap xmlns="">
  <sitemapnode url="home" title="Home" description="Home">
     <sitemapnode url="products" title="Products" description="Products">
     <sitemapnode url="news" title="News" description="News">

SiteMapPath Control:
<asp:SiteMapPath ID="SiteMapPath1" runat="server" SkipLinkText="">

Routing in Global.asax:
void Application_Start(object sender, EventArgs e) 

 public static void RegisterRoutes(RouteCollection routes)
        routes.MapPageRoute("home", "home", "~/Default.aspx");
        routes.MapPageRoute("products", "products", "~/Products.aspx");
        routes.MapPageRoute("news", "news", "~/News.aspx");

Hope your guys can give me a hand, thank you.
Updated 13-Feb-12 17:31pm
Sunasara Imdadhusen 17-Oct-11 7:22am
Please provide snippet of code!
zhgfsh 25-Oct-11 10:20am
thank you, i updated with few code


I think its not matching

"home/" to "home"

in Mappageroute table you've to add one more tag for that like

 routes.MapPageRoute("home/", "home", "~/Default.aspx");
routes.MapPageRoute("home", "home", "~/Default.aspx");
        routes.MapPageRoute("products", "products", "~/Products.aspx");
        routes.MapPageRoute("news", "news", "~/News.aspx");

I guess it works

All the Best
routes.Add("home", new Route("home", new SiteRouteHandler() { PageVirtualPath = "~/default.aspx" })); 
        routes.Add("homedefault", new Route("", new SiteRouteHandler() { PageVirtualPath = "~/default.aspx" })); 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900