> -----Original Message-----
> From: Dylan Bromby [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 30, 2001 9:38 AM
> To: CF-Talk
> Subject: RE: COOKIE expiration :((
>
>
> post the code.
>
> otherwise - and you may already know this:
>
> remember...if you load a page with CFCOOKIE (or write a cookie any other
> way) then quit the browser, the cookie *is not* set. you need to load a
> subsequent page.
>
> for example, consider the path:
>
> page1.cfm ---> page2.cfm ---> page3.cfm
>
> assume: you login on page 1. page 2 uses CFCOOKIE to write to the client.
> page 3 does something else.
>
> if you don't go to page 3, the cookie won't be set since the CFCOOKIE code
> is in page 2. this is also why you can' access the cookie object from the
> same file that sets it. this isn't a limit of CF, it's how cookies work.
>
> so if you quit the browser right after the file that contains CFCOOKIE,
> that's why it's not persisting.
This isn't true. If you set a cookie in page2.cfm and then quit the browser and open
it up again and go to a page that tests for that cookie, it will be there. It was
easy enough to write a couple of pages to test out what you said. The cookie does get
set because all of the header information is sent to the browser, the browser sets the
cookies, then the browser renders the page. If you check for the cookie on the same
page using IsDefined("cookie.whatever"), it will in fact tell you it is there. You
can also test this by just loading a cfm page that sets a cookie, then quitting the
browser and looking in your COOKIES folder for evidence that it is set, even before
you reload the browser.
Also, the problem with using cfcookie before a cflocation is that cflocation sends an
entirely new header to the browser, regardless of what was sent as header information
before it, which would include the setting of a cookie. A JavaScript redirect is a
client-side redirect, which is why it works, whereas cflocation is a server-side
redirect.
-Andy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists