Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFCOOKIE expires="NOW" does not work

Status
Not open for further replies.

Rachel80

Programmer
May 25, 2000
63
GB
This is the sample coding:<br><br>&lt;cfif isdefined(&quot;cookie.icode&quot;)&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfquery name=&quot;cancel&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;datasource=&quot;spg_DB&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dbtype=&quot;odbc&quot;&gt;<br> <br> &nbsp;&nbsp;delete from notice_table<br> &nbsp;&nbsp;where notice_code=#cookie.icode#<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/cfquery&gt; <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfcookie name=&quot;icode&quot; expires=&quot;now&quot;&gt;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cflocation url=&quot;maintainNotices.cfm&quot;&gt;<br>&lt;/cfif&gt;<br><br>after the page is directed to maintainNotices.cfm, data is deleted from notice_table but the cookie.icode still exists. please help, thank you.<br>
 
that is because you are doing a CFLOCATION right after you set the cookie, therefore the cookie never gets sent to the client as you are redirecting to another page.<br> <p>Russ Michaels<br><a href=mailto:russ@satachi.com>russ@satachi.com</a><br><a href= Internet Development</a><br>Rapid Web application development, specialising in Coldfusion, database integration and e-commerce solutions.
 
oh, so that's the reason..<br>then what can i do to set the cookie expires,<br>& after that to do a cflocation??
 
Did you ever resolve this problem. I have a similar one.
 
nope, i didn't..
b'coz i stopped working on that assignment.
But i would like to find out the answers too!
 
I have since found an answer.

Use Javascript ie. location.href=&quot;maintainNotices.cfm&quot; instead of <CFlocation>.

I don't know why, but it does work??
 
I thought that the function &quot;now&quot; needed to be enclosed in pound signs, not to mention parenthesis: <cfcookie name=&quot;icode&quot; expires=&quot;#now()#&quot;>

Try that. [sig]<p> <br><a href=mailto:aberman@thebiz.net>aberman@thebiz.net</a><br><a href= > </a><br>Database web programmer and developer, fueled by peach snapple and mochas.[/sig]
 
I just had this problem and the answer was not to use the CFLOCATION, but to use CFHEADER.

<CFCOOKIE NAME=&quot;someName&quot; VALUE=&quot;SomeValue&quot;>
<CFHEADER NAME=&quot;Refresh&quot; VALUE=&quot;0; URL=SomeURL.cfm&quot;> [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top