使用IIS 7重写模块重写Ampersand URL

Pat*_*ato 9 url asp.net-mvc iis-7 url-rewriting ampersand

如何&在web.config文件中的url重写规则中使用&符号()?

我想重写网址:

http://www.foo.com/index.asp?SomeParameter=SomeValue&SomeId=00
Run Code Online (Sandbox Code Playgroud)

至:

http://www.foo.com/Section/Page
Run Code Online (Sandbox Code Playgroud)

我在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>
Run Code Online (Sandbox Code Playgroud)

但是我&在输入网址中遇到了Ampersand()的问题.在尝试重写时我得到:

无法访问请求的页面,因为页面的相关配置数据无效.

我试图解析&符号%26,但我得到同样的错误.

小智 13

尝试使用HTML&符号字符代码 &amp;