In my Asp.Net Mvc project I’d like to have a good looking urls, e.g. mysite.com/Page2, and I want to redirect from my old style urls (such as mysite.com?page=2) with 301 state so that there won’t be two urls with identical content. Is there a way to do it?
As far as I know Asp.Net binding framework doesn’t make difference between query string and curly brace params
Well, as far as I can see performing such redirection in ASP.NET MVC might be tricky. This is how I did it:
global.asax:
QueryStringRoute.cs:
QueryStringUrlController.cs:
Assuming you have such routing as in my global.asax file (listed above) you can create a custom
Routeclass that will handle incoming requests and map them on a special redirection controller which will then redirect them to appropriate urls with 301 state. Then you must add this route to global.asax before your “Article” routes