Skip to main content

[Coldfusion 9] Session is Invalid Error Exception

Session  is Invalid error message could be caused by cookies, I faced this error exception caused by cookies and I really has no clue why, anyway below is the solution for this error exception:
<textarea>
<!--- Application.cfm --->
<cftry>
<cfapplication name="web" sessionmanagement="yes" sessiontimeout="#createtimespan(0,0,45,0)#">
<!--- Your code here --->

<cfcatch type="any">
<cfif isDefined("exception.message")>
       <cfif exception.message is "Session is invalid">
<cfcontent reset="yes">
             <cfset tx = structclear(cookie)>
<script type="text/javascript">
window.setTimeout(redir, 100);
function redir()
{
window.location = 'rootdirectory?reset=<cfoutput>#getTickCount()#</cfoutput>';
}
</script>
    <cfabort>
</cfif>
</cfif>
</cfcatch>
</cftry>

Comments