Coldfusion sessionid is not generated

I have a ColdFusion 9 application using application.cfc

and it creates the session as it should, but when I dump the session, there is cfid and cftoken and sometimes urltoken but no sessionid and I cannot link to SESSION.SessionID

in my code as it says that it is undefined.

What would cause it to create cfid and cftoken just fine, but not sessionid?

<cfset THIS.Name = "AppNameRedacted" /> 
<cfset THIS.ApplicationTimeout = CreateTimeSpan( 2, 0, 0, 0 ) /> 
<cfset THIS.SessionManagement = true /> 
<cfset THIS.SessionTimeout = CreateTimeSpan( 0, 2, 30, 0 ) /> 
<cfset THIS.SetClientCookies = true />

      

EDIT: onSessionStart () function

<cffunction name="OnSessionStart" access="public" returntype="void" output="false" hint="Fires when the session is first created."> 
    <cfset var LOCAL = {} /> 
    <cfset LOCAL.CFID = SESSION.CFID /> 
    <cfset LOCAL.CFTOKEN = SESSION.CFTOKEN /> 
    <!--- Clear the session. ---> 
    <cfset StructClear( SESSION ) /> 
    <cfset SESSION.CFID = LOCAL.CFID /> 
    <cfset SESSION.CFTOKEN = LOCAL.CFTOKEN /> 
    <!--- Return out. ---> 
    <cfreturn /> 
</cffunction>
      

+3


source to share


1 answer


Here are the ColdFusion 9 docs that describe the variables you can expect in session scope and when.



In your posted code, you do a structClear () on the session scope, which removes all variables from it. The only two variables that you return are CFID and CFTOKEN.

+3


source







All Articles