Here is my solution to close the session on browser close.

For Hal Helm's solution, see www.halhelms.com  Closing sessions on browser 
close
This tutorial explains how to make application sessions expire when the 
user closes their browser.

Put this code in a global location, say app_global.cfm or 
application.cfm.  Make sure to use the <CF_LOCATION> custom tag, not 
<CFLOCATION>

=======================================
<CFIF Not IsDefined("Cookie.Online")>

         <CFLOOP LIST="#GetClientVariablesList ()#" index="curvar">
                 <CFSET temp=DeleteClientVariable(curvar) >
         </cfloop>

         <CFCOOKIE name="ONLINE" value="TRUE">

         <CF_LOCATION url="index.cfm?fuseaction=main">

</CFIF>
=======================================

NOTE: this code has the added side effect of forcing the user to come to 
the main fuseaction (or whichever one you set) when they first come to the 
site. ie, you can't open a link to any other fuseaction as the first page, 
and expect it to work. This may or may not be desired.

I guess you could fix that like this, but you will need to run the code 
after the <CF_URLFORM2ATTRIBUTES> tag:

<CF_LOCATION url="index.cfm?fuseaction=#attributes.fuseaction#">








At 02:58 PM 5/21/01, Andrew Middleton wrote:
>Some while back I saw a post for code to destroy
>client variables when a user logs out of a system.  My
>problem is I have a fusebox app that refuses every now
>and then to let go of client vars, and using
>
><CFLOOP INDEX="varname"
>LIST="#GetClientVariablesList()#">
>    <CFSET DeleteClientVariable(varname)>
></CFLOOP>
>
>doesn't seem to get rid of them entirely. I am working
>on an Oracle 8i db, and my initial query pulls data on
>the user to make sure they are registered. This works
>for the userid I am testing in SQL Plus, but I get
>bumped out in the app (I think) because of a client
>var for failed authorizations which is set to true. I
>can provide more code, but I am thinking this is due
>to the db not letting go of those vars.
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to