Avatar of chawtee
chawtee

asked on 

How to prevent user from using the back button to go back to previous viited pages after logging out?

Hi,
 I have a question, regarding preventing users from using BACK button on the browser to visit the previous pages in the website.

E.g

1) User log in
2) surf at a.asp
3)surf at b.asp
4) click on log out.

I wan to make sure user cannot surf back b.asp once he has log out by clicking the back button on the browser.

I tried many method.
Method 1
------------
using session variable to store the ID at every page. This prevents the users from directly accessing individual pages. IT works. But once user CLICK back button, they can go back becos i think the session is still there. I tried session.timeout also cannot. I tried session("loginID")="" after logging out also cannot. THey still can go to the b.asp page by click back.

Method 2
----------

I used meta tags to solve the problem.

<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Expires" CONTENT="0">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

it don't work too.

 have no idea what else can i try..pls help me......i have been trying it for a week.....
 
Web Development

Avatar of undefined
Last Comment
chawtee

8/22/2022 - Mon