2

我正在使用以下规则将域映射到共享托管环境中的子文件夹:

<rule name="mydomain.co.uk">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^www.mydomain.co.uk$" />
<add input="{HTTP_HOST}" pattern="^mydomain.co.uk$" />
</conditions>
<action type="Rewrite" url="MyDomainFolder/{PATH_INFO}" />
</rule>

此规则允许我访问我的网站 www.mydomain.co.uk 而不是 www.mydomain.co.uk/MyDomainFolder/。

问题是规则更改了我的应用程序的虚拟根目录。带有 href="PageTwo.aspx" 的控件变为 href="MyDomainFolder/PageTwo.aspx" 这在使用波浪号时也是如此: href="~/PageTwo.aspx" 变为 href="MyDomainFolder/PageTwo.aspx"

出于某种原因,这似乎阻止了 response.redirect 的工作?

有谁知道如何修复链接和response.redirect?

4

1 回答 1

0

What you really seem to need is both a response filter AND a rewrite

if you are using IIS 7 the URLRewrite plugin supports this two way rewriting:

http://www.iis.net/download/urlrewrite

they refer to them as inbound (rewrite) and outbound (response filtering) rules

于 2010-11-05T04:29:23.277 回答