开发者

Is it possible to turn off the canonical hostname URL Rewrite rule from the codebehind?

开发者 https://www.devze.com 2023-01-17 13:25 出处:网络
I was wondering it is possibl开发者_Python百科e to turn off the canonical hostname URL Rewrite rule from the URL Rewrite 2.0 IIS 7.5 Module.

I was wondering it is possibl开发者_Python百科e 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: VS 2010 configuration transformation produces unwanted white space during deployment 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;
}


 <add input="{HTTP_HOST}" pattern="localhost" negate="true" />
0

精彩评论

暂无评论...
验证码 换一张
取 消