I assume you want to tell the user that they've been away too long and lost all
their Session values. I did this in application.cfm as follows many years ago.
Be very careful (as described) if you choose the CFLOCATION method to inform
the user.
<CFSET wrkTOdd = 0>
<CFSET wrkTOhh = 0>
<CFSET wrkTOmm = 20>
<CFSET wrkTOss = 0>
<CFSET wrkTimeOut = #CreateTimeSpan(wrkTOdd, wrkTOhh, wrkTOmm, wrkTOss)#>
<CFAPPLICATION NAME="XXXXXX"
SESSIONMANAGEMENT="Yes"
loginstorage="cookie"
SESSIONTIMEOUT=#wrkTimeOut#>
</CFIF>
<!--- All your login, etc. logic perhaps setting flags to test at bottom --->
<!--- Set session variables --->
<!--- Time Out control --->
<cfif not IsDefined("Session.Status")>
<cfset Session.Status = "Undefined"><!--- This identifies timeouts --->
</cfif>
<cfif not IsDefined("Session.TOdd")><!--- Your time out page can tell them the
settings --->
<cfset Session.TOdd = wrkTOdd>
<cfset Session.TOhh = wrkTOhh>
<cfset Session.TOmm = wrkTOmm>
<cfset Session.TOss = wrkTOss>
</cfif>
<!--- All your other session variable defaulting --->
<!--- Last thing to do in application.cfm --->
<!--- Check for Time Outs --->
<cfif Session.Status eq "Undefined">
<!--- We know for sure the Session did NOT exist however,
the crux of the issue is to determine under what conditions
it's first time in (blank browser, coming in from an
application list main menu, coming from a login page, etc.)
and not really a time out --->
<cfif CGI.HTTP_REFERER EQ "" OR
varJustLoggedIn eq "Y" or
Right(CGI.HTTP_REFERER, 9) eq "index.cfm" or
(Not ListGetAt(CGI.HTTP_REFERER,5,"/") EQ
ListGetAt(CF_TEMPLATE_PATH,6,"\")) or
Right(HTTP_REFERER, 12) eq "page_toc.cfm" or
Right(CGI.HTTP_REFERER, 24) eq "page_Apps_Navigation.cfm">
<cfset Session.Status = "Active">
<cfelse>
<cfset Session.Status = "TimedOut">
<cfif Right(CF_TEMPLATE_PATH, 17) eq "page_TimedOut.cfm">
<!--- If you're going to setup a special page the above line is
abolutely critical because on a CFLOCATION application.cfm
fires a second time. If you don't bypass on second time you
induce a server loop. If you don't want to chance it, put
your timeout html in place of this if block with a CFABORT --->
<cfelse>
<CFLOCATION addtoken="No" url="page_TimedOut.cfm">
</cfif>
</cfif>
<cfelse>
<cfset Session.Status = "Active">
</cfif>