Editor's Note: This was written in August
2009. Changes to ASP.NET 4.0 are expected that will impact the validity of some
of the findings in this article in the future.
One of the features of ASP.NET 4.0 is built-in support for
Bi-directional URL Routing. With VS 2010 Beta 1 out for sometime, I dig into
more details with some hands-on work. In this article I will show the implementation
of URL routing with .NET framework 4 Beta 1. It will also cover benefits of URL
routing and changes with ASP.NET 4.0. Mainly we will be seeing how ASP.NET 4.0
makes things easier by implementing bi-directional routing with the help of
components like RouteTable, PageRouteHandler and ExpressionBuilders. This
allows ASP.NET 4.0 users to easily decouple URLs from physical files.
Why URL Routing
URL is now considered as a part of User Interface (UI) and
needs proper attention. Some of the advantages are:
·
Help in SEO (Search Engine Optimization) and hence improve page
hits by putting relevant keywords in the URL.
·
Users are becoming more tech savvy and find directly manipulating
the URL easier than inputting text boxes and clicking buttons.
·
Short and easy to type URLs are good.
·
URLs are persistent i.e. users do not want to rely on your page
names and folder structure when application is accessed. For e.g. if a user
bookmarks a page and for some reasons developer need to restructure the code
files. User might not get to the same page through the same bookmark.