> Well take this... > > <cfcookie name="duh" value="duhhuh" expires="20"> > <cfoutput>#cookie.duhhuh#</cfoutput> > > Put it in a template and hit it once... don't refresh. > Then close your browser and take just the <cfcookie...> tag out... > > <cfoutput>#cookie.duh#</cfoutput> > > And visit the page again. > > The content of the cookie is displayed in both cases. If what > you said was true it wouldn't display on the first and throw > an error on the second. It may set headers for the cookie, I > don't know... but I do know you can access a cookie's content > on the same page. Granted... it may just be a variable scoped > as "cookie" as far as CF is concerned on the first page... > but its there. > > Being there on the second page leads me to believe that it > was completely set on the first page without proceeding to > another page.
What you're seeing is a bit odd, actually, and really needs a bit of explanation. When you set a cookie within a page, CF adds a Set-Cookie header to the HTTP response containing that page. You cannot be sure that the browser has accepted the cookie until the browser requests another page, in which case there'll be an HTTP request header containing the cookie. However, in CFMX when you set a cookie using the CFCOOKIE tag, the cookie will be available within that page as a variable, even though it hasn't been sent from the browser. My suspicion is that this "feature" was added within CFMX to make things easier for developers, but the upshot is that you may be able to reference a cookie even though it hasn't actually been accepted by the browser and returned on a subsequent page request. If you actually want to see what cookies have been sent from the browser, you'll need to look at CGI.HTTP_COOKIE instead of the Cookie scope. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190989 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

