View Full Version : ColdFusion on Timeout

11-24-2003, 04:09 AM
How do I detect when a user session expires/close the IE window/system hangs?
On the above events, I would like to call a query to update a table in the database.
Thanks for any advice.

11-24-2003, 02:08 PM
That is going to be a pain since you do not know when the browser is officailly closed.

Are you using sessions on the server?

You might be able to run a Script every X amount of minutes to see the user sessions, but it will be a lot more hassle then it is worth in my book


11-25-2003, 08:31 PM
Yeah and since ColdConFusion doesn't have session events.

A crude and somewhat inefficent wasy to do it would be to run an include a script using the <cfinclude ... > tag that on every page view it checks the person's IP address against a table in your database and it inserts/updates their other field which would be the the date and time. And then you could run another query to see which entries dates are older than 20 minutes (or whatever length of time) then it can do whatever you need it to do. You should even have another field that marks the field processed so you aren't doing it multiple times to an expired field.

That make sense?