Michael Buffington

Cookies & CFHEADER

Friday, July 11 2003

I always forget how to create cookies in ColdFusion using the CFHEADER tag, so here’s a reminder:

<cfheader name=“Set-Cookie” value="mycookie=pong;expires=ddd, dd-mmm-yyyy HH:mm:ss GMT

“></CODE>


For a domain cookie:


<cfheader name=”Set-Cookie" value=“mycookie=pong;expires=ddd, dd-mmm-yyyy HH:mm:ss GMT; path=/; domain=.domain.com;”>


Using CFHEADER gives you more control over setting cookies than something like CFCOOKIE or using CFSET would.

</p>