0

In my asp.net application user login is available. After user logged out and if pressed the back button it goes to the previously visited page. I need to control the user to again login to enter into the website. How to solve this problem. I writing code in vb.

Manivel
  • 39
  • 1
  • 2
  • 10
  • This has been asked a few times before, try to use the search. See for example [ASP.NET authentication login and logout with browser back button](http://stackoverflow.com/questions/2686946/asp-net-authentication-login-and-logout-with-browser-back-button). – CodeCaster Mar 19 '14 at 12:10

4 Answers4

0

At log out button_click ,

perform session.Abondon();

and Check the session in each page_Load like

if(session["userName"]!=null)
{
  //Perform the action
}
else
{
  //Redirect to login page
}
Revan
  • 1,104
  • 12
  • 27
0

Use the following code on logout click

 Session.RemoveAll();
 Session.Abandon();
user2978233
  • 55
  • 1
  • 1
  • 6
0

add this logout button

Session.Abandon();
Nagaraj S
  • 13,316
  • 6
  • 32
  • 53
0

You can use this...

<script type = "text/javascript" >
  function preventBack() { window.history.forward(); }
  setTimeout("preventBack()", 0);
  window.onunload = function () { null };
</script>
Jameem
  • 1,840
  • 3
  • 15
  • 26