views:

50

answers:

2

I noticed that ASP.NET 4 has a new feature called 'Routing' or something similar. It apparently allows me to use cleaner looking URLs, which purportedly is both for looks and improved SEO. In my case use only basic URLs with little to no GET queries (ie. index.aspx, login.aspx, manage.aspx etc.) Would the ASP.NET routing be of use to me? How would it actually improve my SEO? How is it enabled (ie. do I change login.aspx to /login, or something else?)


I tested a 'route' and noticed that I am just replicating a log of behaviors to drop ".aspx" off my URLs (ie. I change /Login.aspx to /Login). Is there a short-hand version of routing to just drop .aspx off all pages throughout the application?

A: 

It sounds like the simplest thing you want to do is make some standard routes and patterns for your site. You'd register those in your application startup:

http://msdn.microsoft.com/en-us/library/cc668201.aspx#adding_routes_to_a_web_forms_application

The rest of that article goes into deeper detail on what else you can do.

As for actually being an improvement, that all depends on your team and your audience. Adding the routes to a webforms application is an extra layer of obfuscation so it adds a bit to the support and maintenance. But it also makes the URLs very easy to read and understand for the users. If you can find a good balance that keeps the route patterns obvious to the developers and intuitive to the users, it should work out pretty well.

David
A: 

I've gone on record as being skeptical of the SEO benefits of "friendly" URLs, but no one would dispute that they are nicer for humans to read. If that is something that is important to you, then you might consider using the new routing features in ASP.NET.

This article runs through all of the details, but basically, it involves writing some code in the Application_Start event in your global.asax file to match up URLs to physical ASP.NET web forms. For example:

RouteTable.Routes.MapPageRoute(
    "Login",                // a name for this route
    "login",                // the URL to map
    "~/Login.aspx");        // the web form page to which to route  
Matt Peterson