IIS Express, Rewrite rules, IE9, and a whole lotta fun

IIS Express is great for web developers. Being able to test things using a “proper” Web Server rather than Cassini with it’s quirks but without needing the hassle of running a full IIS setup is a great timesaver, and plus it means you have the ability to use additional IIS modules locally, such as the IIS Rewrite modules.

Today I accidentally left a production ‘non www to www’ redirection rule enabled locally on a site I was working on, and so of course when I ran it up I was redirected through to www.localhost – I went and disabled the rule, but yet hitting localhost with the site’s port kept attempting to apply the redirection to www.localhost.

I had the rule disabled already, so I deleted it. I restarted IIS Express and restarted Visual Studio – but the redirect was still happening.

After hunting through IIS Express’s configuration files I realised that the culprit was actually the browser I use for testing, IE9. It seems that when IE9 is told that a redirection is permanent, it REALLY believes that, and it’s not until I cleared the browsing history that I could get back to the site without the redirection being applied. It’s interesting that it seems to treat site/port as a unique combo here, so http://localhost:54271/ was exhibiting this issue where as http://localhost:3271/ wasn’t.

Anyway it’s kind of obvious when you think about it, but it had me scratching my head for a few minutes.

Tags: ,

Posted on Wednesday, May 18, 2011 9:45 PM |

Like this? Share it!

No comments posted yet.

Post a comment
Please add 1 and 1 and type the answer here:
Remember me?
Ensure the word in this box says 'orange':