Weird IIS7 http redirection behavior

Posted by wows on Stack Overflow See other posts from Stack Overflow or by wows
Published on 2009-10-20T20:36:08Z Indexed on 2010/06/12 15:03 UTC
Read the original article Hit count: 352

Filed under:
|
|

I have a web server running Windows Server 2008 with IIS7. I have a bunch of websites which are all bound to the same IP address, but with different host header values. Most of the host headers are something like www.sitename.com.

I also have a corresponding website entry for each which listens for the host "sitename.com" and does a redirect to "www.sitename.com" within IIS7 (to cater for non-www requests). Now this is all pretty straight forward, but I've noticed the when setting up the Http Redirection, some wierd things happen:

Firstly, the "redirect" website entries must be pointed at a different physical directory than the site it's trying to redirect to, otherwise the redirection settings get set for both sites at once.

Secondly, sometimes whilst setting up Http Redirection on an individual site, Http Redirection gets set at a server level, and all sites start redirecting to that one URL.

How does this happen? Under what circumstances could setting Http Redirection on an individual site affect all sites? This is scary!!!

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about http