On my website an authenticated user will have a cookie value that I check as shown below:
When a user logs off the following code is run.
When a user hits the back button in IE, the user is correctly redirected back to the Login page. In Firefox, the user can go back to the previous page as if they had a valid cookie.
I noticed that after I used the back button in Firefox and then if I hit refresh, Firefox will then redirect me to the Login page. I'm surmissing then that the problem is that Firefox is caching the previous page and its values rather than checking the cookie.
Can anyone help me prevent this?
Code:
sSessionUserLogin = trim(cstr(Request.Cookies(COOKIE_USER_LOGIN)))
If Len(sSessionUserLogin) > 0 AND sSessionUserLogin <> vbEmpty Then
///Do Stuff///
ELSE
Response.clear
Response.redirect( "Login.asp")
Response.End
End If
Code:
'Prevent caching on the client
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
Response.Expiresabsolute = Now-1
Response.AddHeader "cache-control","dim"
Response.buffer = true
Response.Cookies(COOKIE_USER_LOGIN) = ""
////More Stuff////
I noticed that after I used the back button in Firefox and then if I hit refresh, Firefox will then redirect me to the Login page. I'm surmissing then that the problem is that Firefox is caching the previous page and its values rather than checking the cookie.
Can anyone help me prevent this?