asp.net-mvc – 使用IIS 7重写模块重写Ampersand URL

前端之家收集整理的这篇文章主要介绍了asp.net-mvc – 使用IIS 7重写模块重写Ampersand URL前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何在web.config文件中的url重写规则中使用&符号(&)?

我想重写网址:

  1. http://www.foo.com/index.asp?SomeParameter=SomeValue&SomeId=00

至:

  1. http://www.foo.com/Section/Page

我在web.config中编写了以下规则:

  1. <rule name="RuleName" stopProcessing="true">
  2. <match url="^index.asp?SomeParameter=SomeValue&SomeId=00" ignoreCase="true" />
  3. <action type="Redirect" url="Section/Page" appendQueryString="false" />
  4. </rule>

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

The requested page cannot be accessed because the related
configuration data for the page is invalid.

我试图将&符解析为&,但我得到同样的错误.

解决方法

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

猜你在找的asp.Net相关文章