locked
restricting to go back RRS feed

  • Question

  • User262367610 posted

    Hi all,

    in my project  i have requirement that i have to restrict the user to go back from webpage.

    the page is opened in a popup so browser back button is not visible,but from keyboard when he presses the backspace he is going back

    i want restrict this.

    please help me

    Thanks in advance

    Madhavi

     

     

    Wednesday, July 2, 2008 8:26 AM

Answers

  • User2032571450 posted

    try these links:

    http://www.4guysfromrolla.com/webtech/111500-1.shtml#postadlink

    <%
      Response.Buffer = True
      Response.ExpiresAbsolute = Now() - 1
      Response.Expires = 0
      Response.CacheControl = "no-cache"
    %>
    
    OR
    <%
      Response.Buffer = True
      Response.ExpiresAbsolute = Now() - 1
      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("FirstTimeToPage") = ""
        Response.Redirect "/Bar.asp"
        Response.End
      End If
    
      'If we reach here, the user can view the page, create the form
    %>
    
    <form method=post action="SomePage.asp">
      <input type=submit>
    </form>
    
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 2, 2008 8:46 AM

All replies

  • User2032571450 posted

    try these links:

    http://www.4guysfromrolla.com/webtech/111500-1.shtml#postadlink

    <%
      Response.Buffer = True
      Response.ExpiresAbsolute = Now() - 1
      Response.Expires = 0
      Response.CacheControl = "no-cache"
    %>
    
    OR
    <%
      Response.Buffer = True
      Response.ExpiresAbsolute = Now() - 1
      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("FirstTimeToPage") = ""
        Response.Redirect "/Bar.asp"
        Response.End
      End If
    
      'If we reach here, the user can view the page, create the form
    %>
    
    <form method=post action="SomePage.asp">
      <input type=submit>
    </form>
    
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 2, 2008 8:46 AM
  • User1710623990 posted

    There is not direct method or properly available to disable back button.
    But alternatively, you can try this:

    • clear previous history OR
    • use page.expires 
    • using javascript some what like this:

    javascript:window.history.forward(1);
    copy this script inside <script language="JavaScript">
    </script>
    every page, where you wish to disable the back button.this will keep user on the same page. i.e. If user try to hit back button on the browser, page will get forwarded again.

    Hope that helps [Yes] 

    Wednesday, July 2, 2008 8:48 AM
  • User262367610 posted

    thanks punith

    its working

    Wednesday, July 2, 2008 9:01 AM