I manage to create the routine to force the user to log on once the session has timeout. However the problem comes about when the user click the Back/Forward button on the browser, and is still able to access the page.
You could create a session variable called Session("loggedin" which is set to False in both your Session_OnStart and Session_OnEnd in your global.asa
When the user logs in, set this value to True.
Then on each page, you can avoid page caching by entering <% Response.Expires=-1 %>, and then run a check (if statement) on the page to make sure that your Session("loggedin" is set to True, if it is continue loading the page, otherwise, ouput a nice message with a link that lets the person know that they are logged out, possibly due to a timeout.
I haven't tested this, but I think it's worth a shot
If Session("Logged" <> "Y" Then
' add some code here to redirect somewhere
' maybe to a login page
Else
Response.Write("<script language=javascript>" & vbcrlf)
Response.Write(" window.history.forward()" & vbcrlf)
Response.Write("</script>"
End If
The "window.history.forward()" sets the history to the most current. In a way it disables the user from going back using the back button.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.