Link to home
Start Free TrialLog in
Avatar of rcmb
rcmb

asked on

Perform action on session timeout

I need an example of how to write to a database on session timeout. My session timeout is set to 30 minutes and I need to record an integer in my user database to indicate the user successfully logged out of the system. The system is designed to keep two people from being logged in at the same time using the same login and password. If the session times out then an action needs to occur to do the following:

<!--#include file="../includes/dbconn.inc"-->
<%
strSQLQuery = "UPDATE Users SET Logout = 0 " _
& "WHERE UserID=" & Session("UserID") & ""
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSQLQuery, conn, 3, 3
%>

I assume you need to use something like a global.asa file with

Sub Session_OnEnd
....
End Sub

but I have no idea how to incorporate writing to a database from a global.asa file.

This is somewhat urgent!!

Thanks in advance for your help.

RCMB
ASKER CERTIFIED SOLUTION
Avatar of NicksonKoh
NicksonKoh
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rcmb
rcmb

ASKER

Thanks to all for your help. I used a little from each of you. The timer was a very good idea and has proven to be very effective.

NiksonKoh -- Thanks for your help with the global.asa -- I have already found this to be very useful!

RCMB