1

Possible Duplicate:
ASP.NET authentication login and logout with browser back button

I want to implement logout functionality that will say remove history of only same website

and will not go to the same page when click "back" button from browser after logout.

I want to implement this in C#.

Community
  • 1
  • 1
Vishal Suthar
  • 17,013
  • 3
  • 59
  • 105
  • 3
    You can't do this. The back button and history are controlled by the browser. Arbitrarily disabling and altering such functionality would be a massive security hole. – Polynomial Nov 16 '11 at 13:24
  • 1
    This is not possible. Browsers don't expose such functionality. – Ikke Nov 16 '11 at 13:24

1 Answers1

2

You are going about it the wrong way. You should do a check for "logged-inn-ness" on every page-load. Using your Session-object for example. And if the check fails, redirect to the "LogIn" page.

Christian Wattengård
  • 5,543
  • 5
  • 30
  • 43
  • 3
    The problem is that browsers cache pages. This means that after the user logs out you can still press the back button of your browser and get the last seen page directly from the cache. So no matter what checks you are doing on the server, when the Back button is pressed the page is served directly from the cache, the server is not even called. So the only way to prevent this is to disable caching of pages which is explained in the duplicate post. – Darin Dimitrov Nov 16 '11 at 13:30