I am getting "Internet Explorer cannot display the webpage" error while trying to redirect ot another page.
string targetURL = "~/AnotherFo开发者_StackOverflow中文版rm.aspx?Xresult=" + HttpUtility.UrlEncode(res);
Response.Redirect(targetURL);
Thanks BB
ResolveURL()
which is used by Response.Redirect()
, doesn't work nicely with UrlEncode, try this:
string targetURL = "~/AnotherForm.aspx?Xresult=" + HttpUtility.UrlEncode(res);
Also check this related SO answer: Response.Redirect using ~ Path
You're miscalling HttpUtility.UrlEncode
.
You should only Encode
the parameter value.
By Encode
ing the entire URL, you are escaping the /
characters, messing up your URL.
精彩评论