[英]URL with multiple parameters as a query string in ASP.NET
In ASP.NET, I build a string redirectURL
to redirect to ADFS
form with multiple query string parameters. 在ASP.NET中,我构建一个字符串redirectURL
以重定向到具有多个查询字符串参数的ADFS
表单。 One such complex parameter is the returnURL
with multiple parameters. 一个这样的复杂参数是具有多个参数的returnURL
。
My problem is that only the first parameter of the returnURL
is available when it actually return. 我的问题是,只有returnURL
的第一个参数在实际返回returnURL
可用。
E.g. redirectURL = <br>
https://aaa.aaa/adfs/Form.aspx <br>
?DomainName=domain <br>
&AccountName=account <br>
&returnURL=https://bbb.bbb/MyPage.aspx?param1=111¶m2=222
I know it complicates when identify the & symbol
of actual parameters and parameters in returnURL
. 我知道在returnURL
识别实际参数和参数的& symbol
时会很复杂。 Please help me to fix this. 请帮我解决这个问题。
Thanks in advance. 提前致谢。
You should use HttpUtility.UrlEncode when composing the link and HttpUtility.UrlDecode when resolving it. 撰写的链接,并HttpUtility.UrlDecode解决时,当您应该使用HttpUtility.UrlEncode。
For your case it should be something similar to: 对于您的情况,它应该类似于:
"https://aaa.aaa/adfs/Form.aspx?DomainName=domain&AccountName=account&returnURL=" +
HttpUtility.UrlEncode("https://bbb.bbb/MyPage.aspx?param1=111¶m2=222")
And then at the target use: 然后在目标使用:
HttpUtility.UrlDecode(Request.QueryString["returnURL"])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.