Saving : Logged Out or Timed Out

Results 1 to 3 of 3

Thread: Saving : Logged Out or Timed Out

  1. #1
    Join Date
    Dec 1969
    Posts
    119

    Default Saving : Logged Out or Timed Out

    I want to save whether a user logged out or was <BR>timed out. <BR>Whats the best way to do this.<BR>Thanks

  2. #2
    Join Date
    Dec 1969
    Posts
    405

    Default RE: Saving : Logged Out or Timed Out

    I&#039ve added this to one of my apps, using a table as an event log:<BR><BR>Clicking logout links to &#039KillSession.asp&#039, which adds a record to the log file noting date, time, employee id, and the term &#039Logout&#039 as the action, and then redirects to the login page. The basics of the script are included below:<BR><BR>sql = ""<BR>sql = sql & "INSERT INTO tblEventlog ( Date, Time, Actor, Actorlevel, Action ) "<BR><BR>sql = sql & "SELECT &#039" & Date() & "&#039, &#039" & Time() & "&#039, " & Session("EmpID") & ", " & Session("UserLevel") & ", &#039Logout&#039 AS ActionVal"<BR><BR>Session("DBConn").Execute(sql)<B R><BR><BR>&#039 Close session and redirect<BR><BR>Session("DBConn").close<BR><BR>Set Session("DBConn") = Nothing<BR><BR>Session.abandon<BR><BR>response.red irect("Login.asp")<BR><BR><BR>To handle timeouts, add a similar line to the global.asa script in &#060;b>Sub Session_OnEnd&#060;/b><BR><BR>The sql is the same, except change &#039Logout&#039 to &#039Logout - Session Timeout&#039 or something similar. When you view the log you&#039ll see the details and can run reports tallying both.<BR><BR>K-<BR><BR>

  3. #3
    Join Date
    Dec 1969
    Posts
    119

    Default RE: Saving : Logged Out or Timed Out

    Thanks a lot Keith<BR><BR>Some doubts<BR>1. What will happen if the user closes the browser when the app is on. Will the Session_onEnd still be called.<BR><BR>2. What if the user jumps to some other site.<BR><BR>Thanks <BR>

Posting Permissions

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