ColdFusion: Delete a Cookie.
Most sources will tell you that in order to delete a cookie using cfcookie, that you need to set it’s expiry time to ‘NOW’.
<cfcookie name="source_id" expires="Now">
For some reason, this seems kludgy to me. Are the browser and the web server going to agree as to what the meaning of ‘Now’ really is?
I prefer a more concrete approach.
<cfset result = StructDelete(cookie, "source_id")>
No if, ands, or buts here. That cookie is toast. At least at the ColdFusion app server level. The cookie still exists on the users machine. But the app server is unaware of this, since it’s internal representation of the cookie has been destroyed, and won’t be rebuilt again unless the cookie is explicitly reset. To be sure, using both methods in conjunction with one another is a safe bet.
