Session Problem

Results 1 to 2 of 2

Thread: Session Problem

  1. #1
    Join Date
    Dec 1969

    Default Session Problem

    i have a problem. i set session expire time 1 min. In following code when i reload page after 1 min(after session expire) then instead of redirecting me to login.asp ASP. Server giving me error page cant be displayed<BR>second problem is server also executing code below IF condition which i dont want to execute after session expire.<BR>Kindly some one help me what is logical error in this code<BR><BR>&#060;%<BR>Response.Buffer=true<BR><BR ><BR>If Session ("username")="" Then <BR>Response.Redirect ("login.asp")<BR>End IF<BR><BR><BR><BR>strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("xyz!1231.mdb")<BR>Set conn = Server.CreateObject("ADODB.Connection")<BR>conn.op en strconn<BR>Set rs = Server.CreateObject("ADODB.Recordset") <BR> sql="Select * From LoggedInUsers Where USER_NAME=&#039;"&Session("username")&"&#039; "<BR> rs.Open sql, Conn, 2,2<BR> If Not(rs.EOF) Then<BR> if Abs(DateDiff("n", Now, CDate(rs("Last_Active"))))&#060;CLng(Session.Timeo ut) Then<BR> Response.Redirect("already_logged.asp")<BR><BR> End If<BR> End If<BR><BR> sql="Select * From LoggedInUsers Where USER_NAME=&#039;"&Session("username")&"&#039; "<BR> Set rs2 = Server.CreateObject("ADODB.Recordset")<BR> rs2.Open sql, Conn, 2,2<BR> <BR> rs2("LAST_ACTIVE") = Now()<BR> rs2.Update <BR> rs2.Close <BR> set rs2= nothing<BR><BR> rs.Close<BR> Set rs=Nothing<BR><BR><BR><BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Session Problem

    It works fine for me.<BR>I let it sit there for a few minutes and then tried it.<BR>I was sent to the login page.<BR><BR>Maybe try letting it sit longer just to see.<BR>I use the same code on my sites with no problems.<BR><BR>Hmmm???<BR>jc

Posting Permissions

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