使用IIS 7重写模块重写&符号
问题描述:
如何在web.config文件的url重写规则中使用&符号(&
)?使用IIS 7重写模块重写&符号
我要重写的网址:
http://www.foo.com/index.asp?SomeParameter=SomeValue&SomeId=00
到:
http://www.foo.com/Section/Page
我写在我的web.config以下规则:
<rule name="RuleName" stopProcessing="true">
<match url="^index.asp?SomeParameter=SomeValue&SomeId=00" ignoreCase="true" />
<action type="Redirect" url="Section/Page" appendQueryString="false" />
</rule>
,但我有输入网址中的&符号(&
)存在问题。当试图重写时,我得到:
请求的页面无法访问,因为页面的相关 配置数据无效。
我试图解析&符号到%26
,但我得到相同的错误。
答
尝试使用HTML&符号字符代码&