how to show the alertbox first and then log out
if (machineID.Count != 0)
{
checkMachineGrpState(machineID);
else
{
Response.Write("<script>alert('You are being logged out')</script>");
GoSignOut();
}
}
private void GoSignout()
{
FormsAuthentication.SignOut();
Session.Abandon();
Response.Redirect("~/Default.aspx");
}
here if i dont call the GosignOut function i can see the alert box but the moment i put call the signout it does not show me the alertbox and simply signs out
So i was thinking if there is a way i can see the alertbox first and then when i press OK it should call signout function in my code behind… thanks
use the clientclick of the server side button that calls this logout code, then return true
e.g.
edit re thought what you want. try this, I have not tested with the use of session.abandon and the Signout (which may force you to the login page)
if you need to allow the redirect to go to a page other than the login page (which is forced due to the SignOut) you can add something like the below to you web.config. I am not 100% sure you want to allow this as it would allow none authenticated users to access the page