Here is the full function:
<cffunction
name="OnSessionstart"
access="public"
returntype="void"
output="false"
hint="Fires when the session is first created.">
<!--- Expire the old Cookie (in case JSESSION set to session type )--->
<cfcookie name="jsessionid" expires="now"/>
<!--- Get the HTTP Response Object --->
<cfset response = getPageContext().getResponse()/>
<!--- Set the specifics for the cookie --->
<cfset path = application.siteDir/>
<cfset domain = cgi.server_name/>
<cfset secure = "Secure"/> <!--- Use val of "Secure" or leave blank --->
<cfset HTTPOnly = "HTTPOnly"/> <!--- Use val of "HTTPOnly" or leave blank --->
<!---<cfscript>
header = "jsessionid" & "=" & session.sessionid & ";domain=." & domain & ";path=" & path & ";" & secure & ";" & HTTPOnly;
response.addHeader("Set-Cookie", header);
</cfscript>--->
<cfif NOT IsDefined("Cookie.CFID")>
<cflock scope="session" type="readonly" timeout="5">
<cfcookie name="CFID" value="#session.CFID#"/>
<cfcookie name="CFTOKEN" value="#session.CFTOKEN#"/>
<cfset session.SessionstartTime = Now()/>
</cflock>
</cfif>
<cfreturn/>
</cffunction>
I have verified the app server is set to use Coldfusion session management, not J2EE session variables, so I'm not sure why all of this is in here. The application is running as intended with no problems, but I'm not convinced this code is actually being used and if so, why? After setting all the variables the script portion is commented out, and then it manually creates CFID and CFTOKEN cookies. I thought ColdFusion automatically sets those anyways? sessionManagement is set to true.
Thanks for any insight!

New Topic/Question
Reply




MultiQuote




|