【发布时间】: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 中遇到了与符号 (&) 相关的问题。尝试重写时我得到:
无法访问请求的页面,因为相关 该页面的配置数据无效。
我尝试将 & 符号解析为 %26,但我得到了同样的错误。
【问题讨论】:
标签: asp.net-mvc url iis-7 url-rewriting ampersand