473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Prevent "Back" Buttom in Browser

I am trying to set up a login-logout website. I have a cookie about the
login status. I put it as logout once the logout link is clicked. And
I put a little security check about the status of the cookie variable
everytime before loading the detailed member profiling.

The page layout is like:

Login page,-->check the login name/password database-->profile page(only
login cookie is true, redirect back to login if false)

Logout link, set login cookie as false and redirect to the login page.
However, after I check a profile and then click logout, I can still get
back to profile page by click "back" button in browser. I was told
those are in the browser cache and the check of the "login" cookie does
not actually work in this situation.

Is there anyway to force the browser to clear the cache after I click
the "logout". It should be possible since lots of websites do that. I
just do not how to. Any help is highly appreciated!
Jul 22 '05 #1
7 4309
Make sure the page isn't cached:
http://www.aspfaq.com/2022
http://msdn.microsoft.com/library/en...am07032000.asp

Also, you can use a client-side redirect (e.g.
window.location.replace('newUrl.asp');) to prevent the current page from
being in the history.

If the page isn't cached and the session value is re-checked, after you've
issued a session.abandon() they shouldn't be able to see the secure content
again without logging in.


However, after I check a profile and then click logout, I can still get
back to profile page by click "back" button in browser.

Jul 22 '05 #2
Also see http://www.aspfaq.com/2017


Is there anyway to force the browser to clear the cache after I click
the "logout".

Jul 22 '05 #3
Thank you. I will try tomorrow and let you know if I fail.

Aaron Bertrand [SQL Server MVP] wrote:
Also see http://www.aspfaq.com/2017

Is there anyway to force the browser to clear the cache after I click
the "logout".


Jul 22 '05 #4
Hi George,

I use the following function in an include:

<%
function noCache()
response.addheader "Cache-Control", "no-store"
response.addheader "Cache-Control", "no-cache"
response.addheader "Pragma", "no-cache"
response.addheader "Cache-Control", "max-age=0, must-revalidate"
response.addheader "Expires", Now-1
end function
%>

and then at the top of any page I don't want cached I simply put <% noCache
%>

hope this helps!

Duane

"George" <sh*********@yahoo.com> wrote in message
news:ek**************@tk2msftngp13.phx.gbl...
I am trying to set up a login-logout website. I have a cookie about the
login status. I put it as logout once the logout link is clicked. And I
put a little security check about the status of the cookie variable
everytime before loading the detailed member profiling.

The page layout is like:

Login page,-->check the login name/password database-->profile page(only
login cookie is true, redirect back to login if false)

Logout link, set login cookie as false and redirect to the login page.
However, after I check a profile and then click logout, I can still get
back to profile page by click "back" button in browser. I was told those
are in the browser cache and the check of the "login" cookie does not
actually work in this situation.

Is there anyway to force the browser to clear the cache after I click the
"logout". It should be possible since lots of websites do that. I just do
not how to. Any help is highly appreciated!

Jul 22 '05 #5
I tried your code in a couple of test pages... and I could not get this to
work. Test.asp had a link to Test_2.asp and if I had the <% noCache %>
included on the second page in the head it would give me a page error. Also
if I did not include the <% noCache %> on the second page I could still
click the back button and the page would open....

--
Regards,

Carroll
"Duane Jackson" <dj******@keyone.co.uk> wrote in message
news:42**********************@ptn-nntp-reader04.plus.net...
Hi George,

I use the following function in an include:

<%
function noCache()
response.addheader "Cache-Control", "no-store"
response.addheader "Cache-Control", "no-cache"
response.addheader "Pragma", "no-cache"
response.addheader "Cache-Control", "max-age=0, must-revalidate"
response.addheader "Expires", Now-1
end function
%>

and then at the top of any page I don't want cached I simply put <% noCache %>

hope this helps!

Duane

"George" <sh*********@yahoo.com> wrote in message
news:ek**************@tk2msftngp13.phx.gbl...
I am trying to set up a login-logout website. I have a cookie about the
login status. I put it as logout once the logout link is clicked. And I
put a little security check about the status of the cookie variable
everytime before loading the detailed member profiling.

The page layout is like:

Login page,-->check the login name/password database-->profile page(only
login cookie is true, redirect back to login if false)

Logout link, set login cookie as false and redirect to the login page.
However, after I check a profile and then click logout, I can still get
back to profile page by click "back" button in browser. I was told those are in the browser cache and the check of the "login" cookie does not
actually work in this situation.

Is there anyway to force the browser to clear the cache after I click the "logout". It should be possible since lots of websites do that. I just do not how to. Any help is highly appreciated!


Jul 22 '05 #6
> it would give me a page error.

Could you be more specific?
Jul 22 '05 #7
> included on the second page in the head it would give me a page error.

It has to be *BEFORE* any HTML.
Jul 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: John | last post by:
Hi, I have to catch the "back" browser's functionality from the menu. I already can catch the key-stroke combination for IE + NS/Firefox and inactivate the mouse right-button, but I still have to...
12
by: VB Programmer | last post by:
I know some sites will display the following message if you click on the BACK button in your browser. How do I implement this feature? Warning: Page has Expired The page you requested was...
2
by: VB Programmer | last post by:
I created a page which I am using to prevent the user from hitting the BACK button. I'll call it my "Auto Jump" page. When it is called it basically auto-redirects to a page specified in the...
2
by: Barry Fitzgerald | last post by:
I have a site that requires a large number of pages to complete the entry of all the information. The information collected also varies depending on some of the data entered. I would like to...
2
by: Leszek Taratuta | last post by:
Hello, I am using the following code to prevent users to see the previous pages: Response.CacheControl = "no-cache"; Response.AddHeader( "Pragma", "no-cache" ); Response.Expires = -1; When...
11
by: John A Grandy | last post by:
asp.net 1.1 ie 6 how to lock-out the user from clicking the browser "Back" button ?
5
by: Diffident | last post by:
Hello All, Most of you might be familiar with this problem i.e, viewstate is lost whenever we navigate from the one page to another. Does anyone have a remedy for this problem? On Page A, I...
8
by: Coleen | last post by:
Yes, I know why would I want to create a back button when there is one on the browser? Because that's what the users want! they want a "Previous" button that they can click from any web page in...
0
by: sagarp86 | last post by:
How to lock / deactivate "Refresh" and "Back" button on browser. Problem is in voting application. Once we click for a vote application goes to next page and increament one vote in the database....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.