0

I am working in ASP.NET and would like to restrict the back button after someone logs into my application. I have a login page and I don't want the user to go back to the previous page when they click the back button.

squillman
  • 13,363
  • 3
  • 41
  • 60
nitendra
  • 1
  • 1

1 Answers1

0

On your login page put this:

if(Session["loggedin"] != null){
  Response.Redirect("Adminpage.aspx");
}

After pressing the login button, and validating the user credentials, do this

Session["loggedin"] = true;

When the user returns to the login page, there it will check whether the users is already logged in and so redirect back to another page.

Note: this will NOT work when the browser of your user has cache turned on. I'm affraid you will have to force a refresh of that page, which you can do using a Meta Tag.

Steven Ryssaert
  • 1,989
  • 15
  • 25