Response.Redirect AFTER调用后重定向到JS Alert或Confirm [英] Response.Redirect AFTER call to JS Alert or Confirm
本文介绍了Response.Redirect AFTER调用后重定向到JS Alert或Confirm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用VB.NET Web应用程序。当某人成功更改了密码后,我想显示一条弹出消息,让他们知道密码已成功更改。他们单击确定后,我想将其重定向到主页。代码如下所示:
I am working on a VB.NET web application. When someone successfully changes their password I want to show a popup message that lets them know it was changed successfully. After they click OK I want to redirect them to the main page. Code looks like this:
ClientScript.RegisterStartupScript(Me.GetType(), "confirmScript", "ConfirmNewUser();", True)
Response.Redirect("MainPage.aspx")
为什么发生重定向并且警报弹出窗口永远不会显示?
Why does the redirect happen and the alert popup never displays?
推荐答案
尝试以下操作:
1)从后面的代码中删除Response.Redirect。
1) Remove Response.Redirect from the code behind.
2)更改ConfirmNewUser函数,如下所示:
2) Change the ConfirmNewUser function as given below:
function ConfirmNewUser(){
//Existing Code of ConfirmNewUser
//New Code.
var msg = "Password changed successfully. Press OK to go to Home page Cancel to stay on current page.";
if(confirm(msg)){
window.location.href = "MainPage.aspx";
}
}
这篇关于Response.Redirect AFTER调用后重定向到JS Alert或Confirm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文