That solution would work, however it would be cleaner to use the
solution Dave Watts suggested....

<cfapplication ... Setclientcookies="no">

<cfif not IsDefined("Cookie.CFID")>
        <cfcookie name="CFID" value="#Session.CFID#">
        <cfcookie name="CFTOKEN" value="#Session.CFTOKEN#"> 
</cfif>

I'd thought of setting them that way but figured cf would reset them
internally or some such. This way you directly tie the session vars to
the browser session, instead of indirectly tying part of the session
vars to the browser session.

Kam

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

Kam:
Are you suggesting that I should store my resultset in a structure
called "records"? And then delete that structure if the cookie does not
exist? Am i right?


On Tue, 7 Dec 2004 11:51:54 -0700, Figy, Kam <[EMAIL PROTECTED]>
wrote:
> 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 Silver Sponsor - New Atlanta
http://www.newatlanta.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186691
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