cffaq.com


Hosted and maintained by Ben Forta. Designed by Trilemetry.
Language:
    © 2002-2007 Ben Forta. All Rights Reserved  
<Home> <FAQ> <Question> <About>

Question

How do you make sessions close when a browser closes?
In ColdFusion MX, this can be achieved very easily. Simply go to your ColdFusion Administrator, select Memory Variables, and add a checkmark by the Use J2EE session variables. In earlier versions, ColdFusion SESSION variables use cookies (named CFID and CFTOKEN) to uniquely identify clients. By default, these cookies are stored to disk and so sessions persist even after a browser closes. To prevent this behavior, simply rewrite the cookies so that they are browser cookies (cookies that expire when a browser closes). The following code snippet writes the two browser cookies:
<CFCOOKIE NAME="cfid" VALUE="#SESSION.cfid#">
<CFCOOKIE NAME="cftoken" VALUE="#SESSION.cftoken#">

Comments


Add Your Comments

Your Name:
Your E-Mail:
Comment:
Verification: Copy the text on the left:

<submit question>