ASP.Net logout code block
Asked Answered
R

2

5

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.

Rubious answered 11/6, 2009 at 14:51 Comment(0)
B
8

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();
}
Bryon answered 11/6, 2009 at 14:59 Comment(0)
S
0

Assuming you're using Forms Authentication, you would just do:

System.Web.FormsAuthentication.SignOut();

Without more information I can't be more specific.

Shardashare answered 11/6, 2009 at 15:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.