I am using ASP.NET 2.0 C#. I want to redirect all request for my web app with \"www\" to without \"www\"
www.example.com to example.com
Or
example.co
We did this on IIS 6 quite simply. We essentially created a second virtual server that had nothing on it than a custom 404 page .aspx page. This page caught any requests for WHATEVERSERVER.com/whateverpage.aspx and redirected to the real server by changing the URL to be www.whateverserver.com/whateverpage.aspx.
Pretty simple to setup, and has the advantage that it will work with any domains that come in to it (if you have multiple domains for instance) without having to setup additional rules for each one. So any requests for www.myoldserver.com/xxx will also get redirected to www.whateverserver.com/xxx
In IIS 7, all this can be done with the URL writing component, but we prefer to keep the redirects off on this virtual server.