Just use J2EE session variables within the CF administrator.

..:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
http://cf4em.com


-----Original Message-----
From: marc -- [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 02, 2008 4:53 PM
To: CF-Talk
Subject: Session variables expireation issue

Hello,
Just a basic question about session variables.I can't get them to 100% work
as I want. Maybe I don't understand so that's when it's time to turn to the
list :)
I want to use session variables that expire a) when the user closes the
browser OR b) when a session times out,whatever comes first. For a) I do
(all in Application.cfc):
<cfset THIS.sessionmanagement="yes">
<cfset THIS.sessiontimeout="#CreateTimeSpan(0,0,0,10)#">
<cfset THIS.setclientcookies="false">
and
<cffunction name="onSessionStart" access="public" description="initialize
session parameters" output="false" returntype="void">
        <cfcookie name="CFID" value="#SESSION.CFID#" >
        <cfcookie name="CFTOKEN" value="#SESSION.CFTOKEN#" >
        <cfreturn />
</cffunction>
This makes that sessions expire when user closes browser.
For b) add the expires tag to CFCOOKIE with the value specified in
THIS.sessiontimeout: if the user does a request _after_the specified timeout
period, the CFID/CFTOKEN cookies are not valid anymore (expires has a
datetime value that is in the past) so coldfusion will create new values for
SESSION.CFID and SESSION.CFTOKEN and call onSessionStart. Setting 2 new
cookies with new values for value and expires.

<cffunction name="onSessionStart" access="public" description="initialize
session parameters" output="false" returntype="void">
        <cfcookie name="CFID" value="#SESSION.CFID#"
expires="#THIS.sessiontimeout#">
        <cfcookie name="CFTOKEN" value="#SESSION.CFTOKEN#"
expires="#THIS.sessiontimeout#">
        <cfreturn />
</cffunction>

To test this I added
        <cfdump var="#SESSION#">
to the onRequest() function.
It turned out that the values displayed in the dump did never change after a
2nd whether that request was within the timespan OR after. That's strange. I
thought that if the 2nd request is after the timepout period new values for
CFID/CFTOKEn are generated. Am I wrong? And if so, is it possible what I
want?

Marc 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:304688
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to