Session Timeout with code to run
I have seen this problem asked and addressed on many other furums, but noone has come up with an answere, yet.
I'm trying to log a user out and end their session when they leave my site. How do I know when they leave my site? The only way I know of is to wait a few seconds and, if they don't make a request to the server, they're gone. Log them out.
I have tried simply making a <cfajaxproxy> call to a cfc that just resets their application.sessiontimeout to 5 seconds, but that doesn't work. The session doesn't time out. I need to log the user out and record the logout in a log on the server and a log file (Not my idea. It's the customer's requirement.) I can get the cfc that I call via the <cfajaxproxy> tag to execute the log entries and I could kill the session there, but I need to give the page time to refresh and see if the user requests a page from my site or an outside site. The problem is if I do these things in the cfc ad delay the execution with a counter or dlay loop, the page doesn't unload until the cfc call is finished. So, no matter how long the delay is, the session will already be wiped out bfore the next page loads.
It's the age-old problem of wanting to log out a user when they leave the site, but not having a way to know where the destination page is or the ability to delay a server action while the browser moves on to the next request. If I can get a delay to work, the user can request a page from my site and I can reset the session timeout before it ends. If they go to another site, the session tmes out and they get logged out.
Any help will be GREATLY appreciated. I've spent days on this.
Thanks,
CFGunny
