Results 1 to 10 of 10

Thread: lock user...

  1. #1
    Join Date
    Mar 2004
    Posts
    53

    Unanswered: lock user...

    how i want to lock user from clicking the back button on the windows...examples like if the click the back button the page will expired

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    this code will expire your page....
    Code:
    <% Response.CacheControl = "no-cache" %>
    <% Response.AddHeader "Pragma", "no-cache" %> 
    <% Response.Expires = -1 %>

  3. #3
    Join Date
    Mar 2004
    Posts
    53

    where to put it????

    i'm sorry if my question is a stupid question.but i really dont know where to put the coding that u gave.i want the default back button at the top of the windows...if the user click...the page will expired....please help me...

  4. #4
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Put rokslide's code at the very top of any ASP page you want to expire (in your case, the page you want to expire if the user clicks "Back"). It should be before anything is written to the browser, so ideally, it should be the very first thing in your ASP script.
    That which does not kill me postpones the inevitable.

  5. #5
    Join Date
    Mar 2004
    Posts
    53

    i've tried

    i've tried it but it still cannot work.how?????

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Can you please be more specific when you say it still cannot work.

  7. #7
    Join Date
    Mar 2004
    Posts
    53

    cannot work

    below is a part of the whole coding


    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!--#include file="Connections/sambung.asp" -->
    <% Response.CacheControl = "no-cache" %>
    <% Response.AddHeader "Pragma", "no-cache" %>
    <% Response.Expires = -1 %>
    <html>

    <%
    Dim getid
    Dim idaduan

    Dim sq
    Dim rs
    Dim rs1
    Dim db
    Dim nama
    Dim x
    Dim y
    Dim z
    Dim diff2
    Dim diff
    getid=session("id")
    set db=Server.CreateObject("ADODB.Connection")
    db.Open"sambung"


    i've put the coding u gave at the top.....as a result...when user click the back arrow....the page did not expired....i think i might done a mistake there...please help me

  8. #8
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    You need to put it on the previous page.. the page they would go to if they click the Back button. All you're doing here is expiring the current page.
    That which does not kill me postpones the inevitable.

  9. #9
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    You can also try:

    Code:
    <%
    Response.AddHeader "Expires", DateAdd("d", -1, Now())
    Response.AddHeader "Last-Modified", Now & " GMT"
    Response.AddHeader "Cache-Control", "no-cache, must-revalidate"
    Response.AddHeader "Pragma", "no-cache"
    Response.CacheControl = False
    Response.Expires = -1
    %>
    That which does not kill me postpones the inevitable.

  10. #10
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    it needs to go before your include I would guess....

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <% Response.CacheControl = "no-cache" %>
    <% Response.AddHeader "Pragma", "no-cache" %>
    <% Response.Expires = -1 %>
    <!--#include file="Connections/sambung.asp" -->

Posting Permissions

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