问题重定向到另一个页面

Bum*_*Bee 2 c# redirect response

在尝试重定向另一个页面时,我收到"Internet Explorer无法显示网页"错误.

string targetURL = "~/AnotherForm.aspx?Xresult=" + HttpUtility.UrlEncode(res);
    Response.Redirect(targetURL);
Run Code Online (Sandbox Code Playgroud)

谢谢BB

Bro*_*ass 5

ResolveURL()使用它Response.Redirect(),与UrlEncode不能很好地协同工作,试试这个:

string targetURL = "~/AnotherForm.aspx?Xresult=" +  HttpUtility.UrlEncode(res);
Run Code Online (Sandbox Code Playgroud)

同时检查这个相关的SO答案:Response.Redirect使用~Path