Asp.net-Mvc

使用 IIS 7 重寫模組重寫 & 符號 URL

  • April 17, 2015

如何&在 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,但我得到了同樣的錯誤。

嘗試使用 HTML & 字元程式碼&

引用自:https://stackoverflow.com/questions/7094846