Preventing user from going back
I know it is not possible to disable the back button or anything, but I dont want the user to be able to go back after hitting the back button. However, it is not working. It does not work at all in mozilla, and I get wierd problems in IE. Here is my code:
This is on the main page load
Code:
Response.Buffer = True
Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))
Response.Expires = 0
Response.CacheControl = "no-cache"
If Len(Session("FirstTimeToPage")) > 0 Then
'The user has come back to this page after having visited
'it... wipe out the session variable and redirect them back
'to the login page
Session.Item("FirstTimeToPage") = ""
Response.Redirect("LoginForm.aspx")
Response.End()
End If
this is when logout is clicked.
Code:
'close the mySQL connection
myConnection.Close()
Session.Item("LogState") = "NO"
'transfer the user to the logout page
Server.Transfer("LogOut.aspx")
Re: Preventing user from going back
I guess this is what you need:
Add the following to your <Body> TAG
Code:
<Body onLoad="if(history.length>0)history.go(+1)">