views:

285

answers:

1

It seems with the built in friendly routing library in .NET MVC, it would allow us to do something like this.

In case it's not obvious what I want to with the built in stuff in .NET MVC, I want to a url starting with www to be automatically redirected to a non-www url using the MVC framework.

+2  A: 

There are a number of ways to do the 301 redirect from the www to the not-www. I prefer to keep this redirection logic at the ASP.NET level (i.e. in my app) in some projects, but others require better performing things, like IIS7 url rewriting.

It was discussed on the ASP.NET forums and I chose to use a WwwFilter on each controller. This has worked for me, no issues.

CVertex
Have deleted my previous answer as this seems to address the user's specific question better, i.e., how to do URL redirection in an ASP.NET MVC-centric way. Whereas I think URL redirection is best handled outside of ASP.NET MVC.
James D