Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
I am the chief technical officer at InVision App, Inc - a prototyping and collaboration platform for designers, built by designers. I also rock out in JavaScript and ColdFusion 24x7.
Meanwhile on Twitter
Loading latest tweet...
Ben Nadel at cf.Objective() 2013 (Bloomington, MN) with:

ColdFusion Kinky eCards Update

By Ben Nadel on
Tags: ColdFusion

Just fixed a small bug in my ColdFusion Kinky eCards Hayden Panettiere demo application. In the OnSessionStart(), I was clearing the session data. However, I was throwing the baby out with the bath water, so to speak, and was actually deleting the CFID and CFTOKEN as well. I am not sure if this was causing any bugs, per say, but I would definitely consider this to be a bad practice. Now, the new code, which can be downloaded from the Kinky eCards Project page has a modified OnSessionStart() event method that restores the CFID and CFTOKEN values after the SESSION scope is cleared:

  • <cffunction
  • name="OnSessionStart"
  • access="public"
  • returntype="void"
  • output="false"
  • hint="Initializes the user's session.">
  •  
  • <!--- Define the local scope. --->
  • <cfset var LOCAL = {} />
  •  
  • <!--- Store the use ID / TOKEN values before we clear. --->
  • <cfset LOCAL.CFID = SESSION.CFID />
  • <cfset LOCAL.CFTOKEN = SESSION.CFTOKEN />
  •  
  • <!---
  • Clear the session. We should do this incase we
  • are re-initializing.
  • --->
  • <cfset StructClear( SESSION ) />
  •  
  • <!--- Restore the ID/TOKEN values. --->
  • <cfset SESSION.CFID = LOCAL.CFID />
  • <cfset SESSION.CFTOKEN = LOCAL.CFTOKEN />
  •  
  • <!---
  • Set up a struct to hold the form data. We the need
  • the form data so that the user can go back and forth on
  • multi-page forms (ex. enter data and preview eCard).
  • --->
  • <cfset SESSION.FormData = {} />
  •  
  • <!--- Return out. --->
  • <cfreturn />
  • </cffunction>
Tweet This Great article by @BenNadel - ColdFusion Kinky eCards Update Thanks my man — you rock the party that rocks the body!



Reader Comments

I'm new here and new to ColdFusion, but i'm a fan of ColdFusion too, thanks for the update, i'm reading the code line by line, hope can get some idea about eCard
Thanks

I'm new here and new to ColdFusion, but i'm a fan of ColdFusion too, thanks for the update, i'm reading the code line by line, hope can get some idea about eCard
Thanks