This is a common question.  The problem is actually with the way CF does the
redirect, not with the browser (which is commonly accused of being the
fault), so this will happen with all browsers.  When CF tells the browser to
redirect, it doesn't set a cookie at the same time.  (I'm not sure why, or
if this is even legal.)  You can see what I mean with the following code and
request log:

Code:

  <CFCOOKIE NAME="test" EXPIRES="NEVER" VALUE="thisIsATest">
  <CFLOCATION URL="/index.cfm" ADDTOKEN="No">

Request:

  GET http://partners.womensforum.com/test.cfm HTTP/1.0
  Proxy-Connection: Keep-Alive
  User-Agent: Mozilla/4.08 [en] (Win98; U ;Nav)
  Host: partners.womensforum.com
  Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
          image/png, */*
  Accept-Encoding: gzip
  Accept-Language: en
  Accept-Charset: iso-8859-1,*,utf-8
  Cookie: CFID=162342; CFMAGIC=162342%3A4486494; CFTOKEN=4486494

Response:

  HTTP/1.1 302 Object Moved
  Location: /
  Server: Microsoft-IIS/4.0
  Content-Type: text/html
  Content-Length: 117

  <head><title>Document Moved</title></head>
  <body><h1>Object Moved</h1>This document may be found
  <a HREF="/">here</a>

So, the answer is:

If you are going to set a cookie then you need to do a soft redirect (with a
META tag or javascript, or whatever) instead of the hard redirect with
CFLOCATION.

HTH,
-Rick

-----Original Message-----
From: Gina Shillitani [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 19, 2000 2:31 PM
To: '[EMAIL PROTECTED]'
Subject: [CF-Talk] CFCOOKIE problems


I am attempting to use this:

<CFCOOKIE NAME="profID" VALUE="#profID#" EXPIRES="NEVER">

to set a cookie on a page. It is not setting the cookie. I'm not sure what
I'm doing wrong but it is aggravating me to no end.

Here is the block of code the above tag is in:

<cfelse>
        <cfset profID = 0>
        <cfmodule template="../getProfID.cfm" geckoKey="#geckoKey#"
                profile_id="#checkCode.profile_id#">
        <cfset SaveMe=Form.SaveMe>
        <CFIF SaveMe IS 1>
        <CFCOOKIE NAME="profID" VALUE="#profID#" EXPIRES="NEVER">
        </CFIF>
        <cflocation url="/index.cfm?profID=#profID#&flogin=1">
</cfif>

Gina Shillitani
[EMAIL PROTECTED]
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to