troubleshooting Question

Aborting ColdFusion execution if session expired

Avatar of SimplyGeeky
SimplyGeekyFlag for United States of America asked on
ColdFusion Language
2 Comments1 Solution793 ViewsLast Modified:
I'm really new to CF (see my other questions) and have some terrible code to work with. We're trying to gracefully fail if the session has expired (the user is proceeding through a series of choices, and when they've reviewed everything, it will be written to the database; until then it's all tracked in session vars). Right now if the session expires before they submit the final time, the app bombs with a CF error "Session.foobar" is not defined...

In my Application.cfm I have (3 minutes is for testing purposes)
<CFAPPLICATION NAME="crhopPublic.1" CLIENTMANAGEMENT="NO" SESSIONMANAGEMENT="YES" SESSIONTIMEOUT="#createTimeSpan(0, 0, 3, 0)#">

<CFPARAM name="session.IsLoggedIn" default="false">

<CFIF "session.IsLoggedIn" EQUAL "false">
  <CFLOCATION URL="session_timeout.cfm">
</CFIF>

And when the user first logs in I have

<cfset "session.IsLoggedIn" = "true">

What's wrong with this picture? (Even if "true" and "false" are literal strings instead of booleans, this logic should work, at least to my mind.)
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 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 2 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