views:

25

answers:

0

Hi,i found something that is not smart done in the URL routing of .net 4.0 and i need a workaround to make it works

my scenario is the following,,i call this method on the application start event handler in global.asax

    void RegisterRoutes(System.Web.Routing.RouteCollection routes)
{
    routes.MapPageRoute("ViewEntities","{CompanyURL}","~/CompanyDetails.aspx");
    routes.MapPageRoute("ViewGovs","{GovName}.aspx","~/Governments.aspx");
} 

the second route rule does not work though my links are built though this line in my source pages

href='<%= Page.GetRouteUrl("ViewGovs", new { GovName = "TestGov" })%>'

It worked when i change the route rule to be in a sub level,,not directly on the root. So the reason is that there are 2 rules defined and both of them works under the root directly (because the 2 pages are actually on the root and any sub level will effect the css and the images in the page).

so does anyone know how to make it works with these 2 routing rules.

Thanks in Advance