Hi Evan,
When you use a cfcookie, the server (IIS or whatever you're using) sends an
HTTP header to the client... and then sends your CF page. So, when you set
a cookie and then immediately test for it, ColdFusion thinks it exists
whether or not the browser accepts it. You have to do something like this:
a) set cookie on page a
b) do a redirect (not using cflocation) to page b
c) test for cookie page b
You can test for a cookie on page b because the browser will request page b,
thus sending any cookies it has accepted.
Hope that helps. If not, you might want to dig into some discussions of
cookies (http://www.netscape.com/newsref/std/cookie_spec.html) and HTTP
headers.
Aaron Johnson, MCSE, MCP+I
Allaire Certified ColdFusion Developer
MINDSEYE, Inc.
<phn>617.350.0339
<fax>617.350.8884
<icq>66172567
[EMAIL PROTECTED]
> -----Original Message-----
> From: Evan Lavidor [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 11, 2001 3:26 PM
> To: CF-Talk
> Subject: Cookie problem: Expires, IsDefined, etc....
>
>
> I'm using CFCOOKIE to set a non-expiring cookie on my users' machines. My
> code in my application.cfm file is as follows:
>
> <cfif Not IsDefined("COOKIE.tid")>
> <cfset TEMP_ID = CreateUUID()>
> <CFCOOKIE NAME="tid" VALUE="#TEMP_ID#" EXPIRES="never">
> </cfif>
>
>
> On a subsequent pages (not the first page where the cookie is
> set) I'm doing
> the following:
>
> <cfif IsDefined("COOKIE.tid")>
> <cfset variables.uid = COOKIE.tid>
> <cfelse>
> <cfset variables.uid = CGI.REMOTE_ADDR>
> </cfif>
>
> so that if they have cookies disabled that I can use their IP instead.
>
> However (and here's the problem), even on a browser with cookies disabled
> that's never been to this site (and I've checked the cookies on
> the machine
> to make sure) I'm still getting a page-based cookie set (i.e. one that
> changes with every reload of the page).
>
> How can I check if the cookie is defined or not if every time CF thinks it
> is? I thought that if users had cookies disabled cfcookie simply wouldn't
> do anything. Why is it setting this temporary value? I am specifying an
> EXPIRES attribute, so I know it's not that...
>
> Thanks for any insight.
>
> Evan
>
> --
> -=-=-=-=-=-=-=-=-=-
> Evan Lavidor
> Circle.com Boston
> Tel: 617-585-3107
> Fax: 617-585-3091
> -=-=-=-=-=-=-=-=-=-
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists