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.
Asked
Active
Viewed 1,049 times
0
-
3"send me the codez" isn't going to get you any help here. – Marc B Mar 02 '11 at 16:10
-
I'm guessing English is not your first language (or is it?) but using "text speak" doesn't help the readability of your question. – Tony Mar 02 '11 at 16:12
-
Proper English seems to be very overrated nowadays.. +1 for @Marc – Steven Ryssaert Mar 02 '11 at 16:12
-
Possible duplicate of http://stackoverflow.com/questions/1921230/redirect-back-to-a-page-after-a-login and http://stackoverflow.com/questions/1562020/restricting-the-use-of-back-button-without-javascript – Tony Mar 02 '11 at 16:20
-
1@Tony , impossible. That's written in plain English. – Steven Ryssaert Mar 02 '11 at 16:22
1 Answers
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
-
Awww... we were hoping for a re-write of the question before anyone posted an answer :) – Tony Mar 02 '11 at 16:13
-
@Tony : What can i say: "we have a site for that ? " http://english.stackexchange.com/ – Steven Ryssaert Mar 02 '11 at 16:15