Subscribe to my full feed.

Wednesday, June 25, 2008

HowTo: Stop ColdFusion Cookies From Vanishing

I encountered this problem recently in my exploration of ColdFusion where I set cookies within the session start function of the application.cfc to track information about how a user found our site, what browser they are using and their general locale.  Using debugger, I could tell that the cookies set properly when I first entered the site.  Once I navigated away from the first page the cfcookies were dropped or missing.

It was driving me nuts.  I did about 20 minutes worth of research before I found a solution.  Basically if I had not set client cookies to no, ColdFusion would try to automatically handle cookies being set on the users machine and apparently it just causes problems.  So I set this by entering the following line of code into my application.cfc.

< cfset setclientcookies="no" >


After I set that, closed and opened the browser and the cookies worked properly.  Hopefully this helps others who have experienced the same thing as me.

Chris

No comments: