URL routing in ASP page

2019-09-01 13:37发布

问题:

The Actual Address is

www.Domain/nav/Default.aspx
www.Domain/nav/Fruit/Apple.aspx

All I want is to hide the 'nav' and 'aspx' text from address.

www.Domain/Default
www.Domain/Fruit/Apple

I tried some Code in Global.asax file

RouteTable.Routes.MapPageRoute("PageRoute", "{0}", "~/{0}.aspx");
RouteTable.Routes.MapPageRoute("PageRoute", "{0}", "~/nav{0}/{0}.aspx");

But its no way working, Can anyone please help me out with the correct code order