[英]Problem redirecting to another page
I am getting "Internet Explorer cannot display the webpage" error while trying to redirect ot another page. 在尝试重定向另一个页面时,我收到“Internet Explorer无法显示网页”错误。
string targetURL = "~/AnotherForm.aspx?Xresult=" + HttpUtility.UrlEncode(res);
Response.Redirect(targetURL);
Thanks BB 谢谢BB
ResolveURL()
which is used by Response.Redirect()
, doesn't work nicely with UrlEncode, try this: ResolveURL()
它使用Response.Redirect()
不以UrlEncode的工作很好,试试这个:
string targetURL = "~/AnotherForm.aspx?Xresult=" + HttpUtility.UrlEncode(res);
Also check this related SO answer: Response.Redirect using ~ Path 同时检查这个相关的SO答案: Response.Redirect使用~Path
You're miscalling HttpUtility.UrlEncode
. 你是在误导
HttpUtility.UrlEncode
。
You should only Encode
the parameter value. 您应该只
Encode
参数值。
By Encode
ing the entire URL, you are escaping the /
characters, messing up your URL. 通过
Encode
整个URL,您将转义/
字符,弄乱您的URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.