Confirm Box is not working while redirecting to other page in ASP.NET
I am implementing one page where user changes his password. Once he successfully changes his password I want to show a confirm box to user that Your password is successfully changed and You will be redirected to Login Page. So once User selects OK, he will be redirected to Login Page. Here in my case I after changing password successfully, I am not get confirm box, but it is simply redirecting to login page. I want to show confirm box to the User. This is my Code.
ScriptManager.RegisterStartupScript (this, typeof(string), "NavigateToLoginPage", String.Format("NavigateToLoginPage();"), true);
Session.RemoveAll();
Session.Clear();
Response.Redirect("LoginPage.aspx", false);
Context.ApplicationInstance.CompleteRequest();
this is my javascript code
function NavigateToLoginPage()
{
var message = confirm("Password is changed successfully, You will be redirected to Login Page. Please confirm");
if(message == true)
{
return true;
}
else
{
return false;
}
}
Please suggest me how can I achieve the desired functionality.
You need Remove Response.Redirect("LoginPage.aspx", false);
And in your Javascript Write Redirect
function NavigateToLoginPage() { var message = confirm("Password is changed successfully, You will be redirected to Login Page. Please confirm"); if(message == true) { document.location.href='LoginPage.aspx' } else { return false; } }链接地址: http://www.djcxy.com/p/12384.html
上一篇: 将Envers添加到现有数据库