Cookies are unique to a browser session (as a matter of fact, CF
determines which session variables to belong to a browser by setting the
CFID and CFTOKEN as cookies).

Something like this (suppose SESSION.records contains whatever records
are in a session):

<cfif NOT IsDefined( 'COOKIE.session' )>
        <cfcookie name="session" value="anything">
        <cfset StructDelete( SESSION, 'records' )>
</cfif>

In Application.cfm. If the user didn't have a browser-session cookie
(COOKIE.session), we create one for them, and then clear the records
cache. If they close their browser, their session (CFID+CFTOKEN or
JSESSIONID) remains active - but their COOKIE.session has disappeared,
so when they come back their cache will get cleared.

Alternatively you could clear the whole session struct to kill the whole
session using StructClear(SESSION).

Hth
Kam
-----Original Message-----
From: Web Exp [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 07, 2004 10:39 AM
To: CF-Talk
Subject: Re: Elementary session question

Thanks Kam, But I need to identify the records entered for that session.
So, what information (other than cfid and cftoken) would be unique to
that browser session?


On Tue, 7 Dec 2004 11:23:15 -0700, Figy, Kam <[EMAIL PROTECTED]>
wrote:
> CF session variables are based on a timeout and (as far as I know) 
> cannot be made to expire when a browser is closed. An option might be 
> to set a browser session cookie (the default behavior of cfcookie) 
> which will expire when the browser closes, and check that - if it no 
> longer exists then clear your session records cache and recreate the
cookie.
> 
> There might be better ways but that's my offhand take.
> 
> Kam
> 
> 
> 
> -----Original Message-----
> From: Web Exp [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 07, 2004 10:04 AM
> To: CF-Talk
> Subject: Elementary session question
> 
> Hi. I am new to session management in CF. My application inserts 
> certain records into the database. After inserting each record, the 
> user gets to see all the records that he added in this particular
session.
> If the user closes browser, and adds more records, he should not see 
> the ones that he added before closing the browser.
> 
> How can i do the above. I tried it by inserting the CFID and CFTOKEN 
> into the database. But these two don't change when the browser is 
> closed. So, how can i track the records added just as long as the 
> browser is open?
> 
> Thanks,
> Ken
> 
> 
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186514
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to