views:

7

answers:

0

I was wondering it is possible to turn off the canonical hostname URL Rewrite rule from the URL Rewrite 2.0 IIS 7.5 Module.

I'm locally developing on a IIS 7.5. The setting of this URL Rewrite rule is set in the web.config.

This is how I deploy: I'm using Webdeploy to publish my web application. The new web.config transforms, which was introduced with VS 2010, is no option for me, because it is bugged: http://stackoverflow.com/questions/3300210/vs-2010-configuration-transformation-produces-unwanted-white-space-during-deploym and will not be fixed until the release of VS2010 SP1. I'm also not using web deployment projects anymore, because Webdeploy does not seem working with web deployment projects. As a result, I manually switch on the rewrite rule in the web.config before deploying.

If I now want to locally debug something, I manually need to turn off the rule.

Is there a solution like this pseudo-code?

if(Properties.Settings.TurnOffCanonicalHostNameWithLocalHost)
{
  URLRewriteModule["CanonicalHostName"].Enabled = false;
}