I need a good logout code block for asp.net. Currently after you logout you can hit the back button and continue using the site.
+3
A:
You need to make sure that the session is abandoned and call the FormsAuthentication.SignOut()
method as shown below:
private void Logout()
{
Session.Abandon();
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
}
Jose Basilio
2009-06-11 14:59:03
A:
There is another StackOverflow question dealing with this problem:
http://stackoverflow.com/questions/612488/logoff-button-iis6-asp-net-basic-authentication
Matthew Jones
2009-06-11 14:59:50
+1
A:
Assuming you're using Forms Authentication, you would just do:
System.Web.FormsAuthentication.SignOut();
Without more information I can't be more specific.
Fred
2009-06-11 15:01:37