Coldfusion Session Cookie

Tag: session , coldfusion , cookies Author: zhuoru1919 Date: 2009-10-17

I am trying to delete the clientside session cookie when I access a certain page. How do I do this?

Best Answer

Do you mean the CFID and CFTOKEN cookies? Or the Sessions struct? You can expire the cookies like this:

<cfcookie name="CFID" value="" expires="NOW" />
<cfcookie name="CFTOKEN" value="" expires="NOW" />

but if you want to clear the session scope you should do this:

<cfscript>
structClear(Session);
</cfscript>

Other Answer1

Set the cookie again, with blank data and an expiry date of now.

<cfcookie name="cookie_name" value="" expires="now" />

It will remain for the rest of the request, and then it should go.