9

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

我想重写网址:

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>

但是我&在输入 url 中遇到了与符号 ( ) 相关的问题。当试图重写我得到:

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

我试图将 & 号解析为%26,但我得到了同样的错误。

4

1 回答 1

14

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

于 2011-09-07T15:50:37.733 回答