Download the EasyCFM.COM Browser Toolbar!
Deleting Session When User Leaves Your Page

This seems like a common question in the forums so I thought I would turn it into a tutorial.

"Thanks to Pablo for the code."

Put this in your application.cfm page:
<!--- routine to clear session when browser closes || This will ensure that the person is logged in correctly when they return --->
<cfif IsDefined("Cookie.CFID") AND IsDefined("Cookie.CFTOKEN")>
  <cfset Variables.cfid_local = Cookie.CFID>
  <cfset Variables.cftoken_local = Cookie.CFTOKEN>
  <cfcookie name=
"CFID" value="#Variables.cfid_local#">
  <cfcookie name=
"CFTOKEN" value="#Variables.cftoken_local#">
</cfif>

The code above will will log them out when they close the browser.



All ColdFusion Tutorials By Author: Chris
  • Creating a Chat System in ColdFusion without using a database!
    Have you ever wanted to have your own chat room? This tutorial will help you have one, but the best thing about this tutorial is that you will not need to use any type of database!
    Author: Chris A.
    Views: 27,360
    Posted Date: Saturday, May 10, 2003
  • Creating a User Login Area Using a CFC
    This tutorial will show you how to create a user login area using a CFC. This is just a basic idea which can easily be modified to fit your needs
    Author: Chris
    Views: 11,960
    Posted Date: Sunday, January 8, 2006
  • Customer Complaint System
    this is just a customer complaint tracking system i put together with coldfusion. i got alot of help from easycfm.com so i figured i would get back with an app. its using an access database to store usernames and passwords. did all of the login authentication code myself because my damn server behaviors were not taking. copy the dbase somewhere and use the HCCTS datasource name enjoy
    Author: chris mcintosh
    Views: 15,170
    Posted Date: Sunday, March 23, 2003
  • Deleting Session When User Leaves Your Page
    This tutorial will show you how to delete sessions when a user closes the browser.
    Author: Chris
    Views: 7,838
    Posted Date: Tuesday, July 18, 2006
  • Intro to Amazon web services
    Learn the basics of building your own eCommerce site using Amazon.coms web services and Cold Fusion.
    Author: Chris Gomez
    Views: 11,702
    Posted Date: Saturday, December 3, 2005
  • Quick and Dirty Contact Forms.
    This is just a simple way to dynamicly generate contact forms without the need for a database.
    Author: Chris Bunting
    Views: 9,930
    Posted Date: Saturday, April 1, 2006
  • Random Image
    Here is a random image display. You can even upload it to the server. Uses a database.
    Author: Chris
    Views: 15,527
    Posted Date: Friday, July 25, 2003