Rule #1
Do you know how to create nice URLs using ASP.NET 4?
  v3.0 Posted at 29/10/2013 6:46 PM by dorbenzhang
There are a lot of reasons to have nice URLs for your website:
  • Easy to remember
  • Easy to navigate 
  • Better for search engines
Bad example – This URL is impossible to remember for your users, and even search don’t like these URLs
Figure: Bad example – This URL is impossible to remember for your users, and even search don’t like these URLs
Good example – Nice clean URL, easy to remember, easy to guess where I am and good for search engines
Figure: Good example – Nice clean URL, easy to remember, easy to guess where I am and good for search engines

With ASP.NET 4 it is easy to create this URLs. The ASP.NET team includes routing features, known from the MVC web framework.
Add a route in Global.asax

protected void Application_Start(object sender, EventArgs e)
{
//RouteTable and PageRouteHandler are in System.Web.Routing
RouteTable.Routes.Add("ProductRoute",
new Route("products/{productname}",
new PageRouteHandler("~/ssw/Products/ProdCategoryList.aspx")));
}​
Figure: Example on how to route www.ssw.com.au/products/{everything} to the www.ssw.com.au/ssw/Products/ProdCategoryList.aspx page

Note: There is no dependency on the MVC framework in order to use this code.
Note: IIS7 has a module called URL rewrite module that can do this functionality without changing any code. Just a configuration of a "Rule" in the IIS Manager.