Hello, I have logout page in asp for session abandon. But after user logout and press back button, the page can still go one page back. How should I modify the code so that the user cannot go backward or if he go backward, there will be warning page to say that the page are expired like those official mailbox.
Thanks very much in advance and wait for your reply!
Although I have no idea how to do this (I know nothing about ASP) what you would probably need to is set a cookie that determines if they are logged in or not, and then check that cookie when the page is loaded. If they are logged in, they can view, else they get an error message.
More secure than allowing to go back no matter what
And it depends on how it is done as well, you don’t just have to use true of false, or if ASP has the ability to delete a cookie you can check if the cookie even exists or not.
*Originally posted by lostinbeta *
**More secure than allowing to go back no matter what
And it depends on how it is done as well, you don’t just have to use true of false, or if ASP has the ability to delete a cookie you can check if the cookie even exists or not. **
LOL
In PHP you can use session_destroy to destroy a session… I don’t know about the equivalent in ASP tho… you’ll have to wait for abzoid
There are sessions(very secure) then there are ways of combining database entries and cookies with random number generator scripts that triple check everything.
Hope that helps, if you need anything more. Let me know.
What happens in one of my favorite scripts…(cause its hard and complex lol)
Is this.
When you access my site.
You try and login.
If you are a user you enter your name and password.
The script checks the database for that password and user combo.
If it exists.
A random number generator generates a number and stores it in one field of the database. It then stores the same number in the cookie value on your machine.
Now each page after that, I have a script check the value in the database with the value in your cookie. If they match you may proceed. If they do not then no access.
Now when the person logs-off… a second random number is generated and stored in one of the locations; making it to where the numbers no longer match.
That way the next person that comes along on the computer cannot just “edit” the cookies to access it.
The random number is around 30 characters long.
Again, if the cookie number doesn’t match the database number; then no access.
Keys here are to protect the database. Most server companies have the database in a separate non-public area of the server.
There are other ways to do this. But that above way is just fun and extremely secure.
If I were going to do this, and I have on more than a few web sites, I’d use a simple session variable instead of messing with client side cookies.
When the user logs in set session(“user”) = {username from database lookup}.
When the user logs out set session(“user”) = “”.
On every secure page check to see **if session(“user”) = “” **and if it does then redirect to login page.
oops, not tables, I meant frames…set up a frameset with 2 frames. Inside each of those 2 frames, 2 frames open up. Inside each of those 4 frames, 2 frames open up…
etc… until crash…
you can even use a random color script on the html pg to make it real purty before it shuts down…
Hello, it is so nice to see all of your answers. I am impressed by all of your help. Currently, what I have coded in my page, is like in every user session page, there is a check for wether session(“ID”) is null. IF it is , then redirect to the login page. Else show the page. For the logout page, I have the session. abandon for it.
But if I press the Back button from the brower’s tool bar, it can always show the former page with the user id shown there, although I cannot do any modification in that page(it will redirect to the login page). But any way, it can go backward.
So in my case, what is the easy way to make sure that user cannot go backward then ?
What they are seeing is in their own browser cache. There is a Meta tag you can include in the page headers that is “supposed” to prevent the page from being cached by the client. I’ve have only limited success using it. (remove the space after the < )
< META HTTP-EQUIV=“PRAGMA” CONTENT=“NO-CACHE” >
Other than that, I know of no way to control what is cached by the clients browser.