具有多个参数的IIS重定向

时间:2014-01-07 21:34:03

标签: asp.net iis http-redirect

当我尝试重定向到查询字符串中包含多个参数的另一个页面时,我收到错误。

这有效:

<rule name="t6" stopProcessing="true">
    <match url="^test.html$" />
    <action type="Redirect" url="mypage.aspx?param=1" redirectType="Permanent" />
</rule>

这不起作用:

<rule name="t6" stopProcessing="true">
    <match url="^test.html$" />
    <action type="Redirect" url="mypage.aspx?param=1&param2=2" redirectType="Permanent" />
</rule>

你能算出发生了什么吗?

谢谢,

阿曼

1 个答案:

答案 0 :(得分:3)

替换

的实例
&

&amp;

所以您的网址参数变为

url="mypage.aspx?param=1&amp;param2=2"

这是xml的编码要求。

参考:Which characters are Invalid (unless encoded) in an XML attribute?

相关问题