Routing URL in ASP.Net (New Feature of ASP.NET 4.0)

Posted by Rajni.Shekhar under ASP.NET category on | Points: 40 | Views : 1478
You can route actual URl to descriptive URl and map to the physical file by using following code.

You have to write code in Application_Start handler of Global.asax file.

RouteTable.Routes.MapPageRoute("ProductsRoute", "product/{prodId}", "~/products.aspx");

1. fisrt parameter routename as a string
2. second parameter route URL as "product/{prodID}" (The URL pattern for the route.)
3. third parameter shows the physical file.

For more details, can refer

Comments or Responses

Login to post response