Brian,

this is a great snippet!!!  Thanks.  I have been wondering how to force the
session to die without an explicit logout.  This will definately do the
trick.

Cheers,

Jeff Garza

----- Original Message -----
From: "Brian Scandale" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, May 09, 2002 11:39 PM
Subject: Re: session cookies to expire immediately on browser close


This is what I use.... I picked it up off .... I don't actually remember
where.... but it works great.

----- this is what I use ---

<!--- At times developers are frustrated that the session does not end
 when the user closes their browser-that they must wait for the session
  to time out. If you've found yourself wishing for this behavior in
  session variables, you'll be happy to know that you can implement this
very easily: --->

<cfif IsDefined( "Cookie.CFID" ) AND IsDefined( "Cookie.CFTOKEN" )>
  <cfset localCFID = Cookie.CFID>
  <cfset localCFTOKEN = Cookie.CFTOKEN>
  <cfcookie name="CFID" value="#localCFID#">
  <cfcookie name="CFTOKEN" value="#localCFTOKEN#">
</cfif>

<!---
 Place this code right beneath your <cfapplication> tag. This code first
 checks to see if the cookies CFID and CFTOKEN exist. Remember that
 ColdFusion will try to set these as cookie variables in the <cfapplication>
tag.
 If they are there, set by <cfapplication> (and due to the peculiar way
cookies operate, they will appear to be present even if the user has their
cookies turned off), the value of these cookies will be read into two local
variables.

 Then the pair of cookies will be overwritten, using the same values they
had
 previously, but this time deliberately omitting the expires property of the
 <cfcookie> tag. Leaving off the expires property causes the cookie to
remain
 in the browser memory, but not to be written to the user's disk. When the
 browser is closed, the cookie information goes with it and, by inference,
 so goes the session.
--->
----------------------------



At 02:04 PM 5/10/02 +0800, you wrote:
> hihi.. where am i suppose to put this.. if i want to set cookie to expire
when browser close.??
>
><cfcookie expires="NOW" name="CFID" value="#cookie.cfid#">
>
>is it at application.cfm?
>
>
>cheers
>han
>
>

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to