【问题标题】:Rewriting Ampersand URLs with IIS 7 Rewriting Module使用 IIS 7 重写模块重写 & 符号 URL
【发布时间】:2011-10-29 00:28:42
【问题描述】:

如何在 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 中遇到了与符号 (&amp;) 相关的问题。尝试重写时我得到:

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

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

【问题讨论】:

    标签: asp.net-mvc url iis-7 url-rewriting ampersand


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2012-06-01
      • 1970-01-01
      • 2013-04-23
      • 1970-01-01
      • 2013-07-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-26
      相关资源
      最近更新 更多