Results 1 to 2 of 2

Thread: Preventing user from going back

  1. #1

    Thread Starter
    Hyperactive Member Grunt's Avatar
    Join Date
    Oct 2004
    Location
    Las Vegas
    Posts
    499

    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")

  2. #2
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    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)">

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width