URL Routing with ASP.NET 4.0

One thing, that was always pinched me , the long URLs that I used to see in my several projects.Due to better managebility, I used to have several folders ie folder hierarchy¬†for maintainability of my application. But the thing that I didn’t like ever that full physical path of pages in URL.There are other ways, which allow us to get rid of it like URL rewriting but that I didn’t like.
Also we could have our own custom URL route handler or some third party
solution
, but they never been strong enough for an application.

Frankly speaking, One of my Client asked me several times , “Why this .aspx extenstion displays in URL” and also told me that he dont like this long urls. I used to tell him, this is the normal behavior of ASP.NET application.But we can change it with our own custom solution but that will require bit time and also require lot of testing.
But when Microsoft releases ASP.NET MVC 2 with .Net framework 3.5 SP1, and provided
this Routing feature with it. I became very happy and started to explore it. In the meantime ,I thought that It should also be provided with ASP.NET, because every time you may not require to follow MVC architecture and also found that MVC has nothing special to do with URL Routing.So I was expecting and waiting
for ASP.NET Webform Routing.
Now Microsoft introduced URL Routing with ASP.NET 4.0.URL routing is fully integrated, very powerful and straight forward.

So What is URL Routing:

We access our webapplication using some URL that is normally the physical path of the of pages.So URL Routing is a way to provide our own URL in lieu of the physical path of the page. One other way, Routing allows us a way to configure our application to accept a requested URL which actually doesn’t map to physical
files. In terms of security perspective of the application, its important because one can easily know the solution structure of the application.

URL Routing

URL Routing


Complete article has been published on CodeProject. To view Click here