Re: cookie expiration date seems incorrect
From last week: Tested the cookie-setting page with the Httpanalyzer. It (header info) does show the cookie being set as I wanted it, and I can see the correct expiration date. I reverted back to original code to simply set the expires attribute (on cfcookie) as 30 (for 30 days). All looked fine. I guess I can only see the cookie information in the header of the template where the cookie is actually being set. There isn't a *cookie reader* that can give expiration date, etc.? Thanks for help, Dave. Helped me clarify what was going on and with a tool to gather information. E. Keith Dodd Wings of Eagles Services www.wingserv.com First, when you set the expiration date, that information is sent to the browser, but not returned when the browser sends the cookie back to the server. It's only used by the browser to determine when it should get rid of the cookie. So, you won't see that information anywhere in your CF variables, using CFDUMP. Second, when you set a cookie, the browser sees something like this: Set-Cookie: CFID=251232; expires=Sun, 27-Sep-2037 00:00:00 GMT; path=/; This HTTP header contains all the information for the cookie, including the expiration date. When you use EXPIRES=NEVER, as in the above example, the cookie is actually set to expire in the relatively distant future, many years from now. Now, when I used CFCOOKIE like so: cfcookie name=foo value=bar expires=2/27/2002 it generated this: Set-Cookie: FOO=bar;expires=Wed, 27-Feb-2002 22:22:05 GMT;path=/ You might find it useful to look at these HTTP headers. One easy way to do that is with HTTP Analyzer: http://ftp.coolfusion.com/pub/ods/httpanalyzer/httpanalyzer.zip You may also want to play around with different date formats; I seem to recall just generating a valid GMT date myself in the past, and using that, but it's been a while. Finally, if you want the cookie to expire in 30 days, why not just say so? cfcookie name=foo value=bar expires=30 Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 - [This E-mail scanned for viruses by declude AntiVirus Software] ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: cookie expiration date seems incorrect
Have set a cookie using cfcookie: cfcookie name=SiteAdmin value=True expires=#Variables.xprDate# The xprDate is set as a month ahead and I've verified is in the form 3/27/2003. Debugging, as well as cfdump of cookie scope shows the presence of proper cookie. (Can't see any expires info) If look in Temporary Internet Files, the cookie info says expires: 2/19/2033 (in the directory tree info). Don't know how to interpret what is actually in the cookie text if look at it. Am I setting this improperly, interpreting the info inproperly, ? Appreciate any help in knowing if I really am setting the cookie to expire in a month. First, when you set the expiration date, that information is sent to the browser, but not returned when the browser sends the cookie back to the server. It's only used by the browser to determine when it should get rid of the cookie. So, you won't see that information anywhere in your CF variables, using CFDUMP. Second, when you set a cookie, the browser sees something like this: Set-Cookie: CFID=251232; expires=Sun, 27-Sep-2037 00:00:00 GMT; path=/; This HTTP header contains all the information for the cookie, including the expiration date. When you use EXPIRES=NEVER, as in the above example, the cookie is actually set to expire in the relatively distant future, many years from now. Now, when I used CFCOOKIE like so: cfcookie name=foo value=bar expires=2/27/2002 it generated this: Set-Cookie: FOO=bar;expires=Wed, 27-Feb-2002 22:22:05 GMT;path=/ You might find it useful to look at these HTTP headers. One easy way to do that is with HTTP Analyzer: http://ftp.coolfusion.com/pub/ods/httpanalyzer/httpanalyzer.zip You may also want to play around with different date formats; I seem to recall just generating a valid GMT date myself in the past, and using that, but it's been a while. Finally, if you want the cookie to expire in 30 days, why not just say so? cfcookie name=foo value=bar expires=30 Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4