troubleshooting Question

How can i determine when a session has expired?

Avatar of paddycobbett
paddycobbett asked on
ColdFusion Language
14 Comments1 Solution1257 ViewsLast Modified:
I need to work out how to determine when a session has expired/timed out. In my application.cfm i declare session management (as attached in the code sample). I presume that all data associated with a SESSION is destroyed when the SESSION timeouts. However, the problem is that the session puts some data in the application scope which i would like to destroy when the SESSION timeouts also, so i need to detect when this occurs. Or to give another reason, i'd like the user to be displayed a reason for being "logged out", i.e. "Please sign in again as your session has expired", rather than just being told to "sign in", right now the system can't distinguish between the 2 cases.

So all i really need to know is how can i determine when a SESSION has timed out? I'm aware of application.CFC, which has a onSessionEnd() (or something like that), however i've had problems using cfajaxproxy with application.CFC, so have remained with application.CFM (this also appeared to not be an uncommon problem having looked on blogs). Either way, the application.cfc is a new inclusion to coldfusion, so what did people do previously to detect the end of a session?

Additionally, i noticed (and correct me if i'm wrong), that the session time out is fixed, i.e. it's not related to "idle time". Is there a built in way to specify an "idle timeout". Or if there's a way to extend the timeout, which i could do by adding a few minutes after each page click (inserting some code in the header of each page for example).

Thanks in advance.
<CFAPPLICATION 	name="myapp" 
	sessiontimeout="#CreateTimeSpan(0, 3, 0, 0)#">
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 14 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros