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.
Just give the href value of logout page. href="Logout. aspx" .
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();
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With