I'd have to verify this again to be sure, but if you use J2EE session variables I *believe* they're killed automatically when the browser closes without doing any extra work (in other words, you use J2EE session variables and this is the default behavior). The error you're seeing when the J2EE sessions are enabled is because it uses a different variable to define the session (jsessionid) so the typical CFID and CFTOKEN aren't present in the session. I think all you'd have to do to handle this would be to do a check for StructKeyExists (Session, "CFID") and StructKeyExists(Session, "CFTOKEN") before doing the cookie stuff. If they don't exist, don't do that cookie stuff and you should be all set.

Matt

On May 22, 2005, at 8:37 PM, Jake McKee wrote:

All,

For some time now, I've been trying to track down a random error that users are seeing. In an admin application, I have the following code that I've seen used a number of times and shared by a number of people to kill active sessions when the browser is closed:

   <CFLOCK timeout="30" name="#session.sessionID#">
<cfparam name="Session.#APPLICATION.adminCookieName#" default="">
       <cfparam name="Session.Password2" default="">
   </CFLOCK>

   <cfif IsDefined("Cookie.CFID") AND IsDefined("Cookie.CFTOKEN")>

       <cfcookie name="CFID" value="#Session.CFID#">
       <cfcookie name="CFTOKEN" value="#Session.CFTOKEN#">
       <cfset cfid_local = Cookie.CFID>
       <cfset cftoken_local = Cookie.CFTOKEN>

   </cfif>


The problem has been that random users were getting the error:

   "Element CFID is undefined in SESSION." (with a reference to the
   <cfcookie name="CFID" value="#Session.CFID#"> line above)

Talking with another CFer today, I was told that if he turned off the J2EE sessions in CF Admin (using CFMX 7), it solved the problem. Removing the code above from its location in the Application.cfm also worked. But this isn't a 6.1 vs. 7.0 issue, as it was happening before the release of 7.0.

Now, here's the question - is there one good, solid way to kill sessions for both J2EE sessions and non-J2EE sessions?

Thanks!
Jake

----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe:   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe:   http://www.dfwcfug.org/form_MemberRegistration.cfm




--
Matthew Woodward
[EMAIL PROTECTED]


----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe: http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to