I wrote this UDF. Please note that httpOnly is only CF9, so you want to remove it under CF8.
<cffunction name="setCookie" access="public" returnType="void" output="false"> <cfargument name="name" type="string" required="true"> <cfargument name="value" type="string" required="false"> <cfargument name="expires" type="any" required="false"> <cfargument name="domain" type="string" required="false"> <cfargument name="httpOnly" type="boolean" required="false"> <cfargument name="path" type="string" required="false"> <cfargument name="secure" type="boolean" required="false"> <cfset var args = {}> <cfset var arg = ""> <cfloop item="arg" collection="#arguments#"> <cfif not isNull(arguments[arg])> <cfset args[arg] = arguments[arg]> </cfif> </cfloop> <cfcookie attributecollection="#args#"> </cffunction> <cfscript> if(!structKeyExists(cookie, "hitcount")) setCookie("hitcount",0); setCookie("hitcount", ++cookie.hitcount); setCookie("foreverknight",createUUID(),"never"); </cfscript> <cfdump var="#cookie#">
Raymond camden
source share