What is the simplest way to redirect a web request to an ASP.NET application to a subdomain?
If a request comes into the URL http://somesite.com/foo.aspx, the new destination URL should be
http://www.somesite.com/foo.aspxorhttp://blog.somesite.com/foo.aspx
How can you programmatically redirect the request to the subdomain, keeping the rest of the URL intact?
You could try something like this
A simple method that you can hook up to the Global.asax
Here’s my Class
and here’s my call in the Global.asax
With that bit of code.. you will always be forced over to the WWW version of your website (providing that the Host Header in IIS has both the www and the non www version listed.)