Solved

CFCOOKIE Not Expiring when I set expires="Now" nor when I set expires=#Now()#

Posted on 2004-03-26
5
696 Views
Last Modified: 2013-12-24
My code is this simple...

<cfcookie name="source_id" value=#source_id# expires=#qrySourceDetails.expiration_date#>
<cfcookie name="source_id" expires=#Now()#>
<cfoutput>#IsDefined("cookie.source_id")#</cfoutput> <!--- Always returns "YES" --->

<cfcookie name="source_id" value=#source_id# expires=#qrySourceDetails.expiration_date#>
<cfcookie name="source_id" expires="Now">
<cfoutput>#IsDefined("cookie.source_id")#</cfoutput> <!--- Always returns "YES" --->
0
Comment
Question by:Kamoku-Wan
5 Comments
 
LVL 3

Author Comment

by:Kamoku-Wan
ID: 10688621
I have also tried...

<cfcookie name="source_id" value=#source_id# expires=#qrySourceDetails.expiration_date#>
<cfcookie name="source_id" expires=Now> <!--- Notice no quotes around Now --->
<cfoutput>#IsDefined("cookie.source_id")#</cfoutput> <!--- Always returns "YES" --->

I am at a loss why this is happening?
0
 
LVL 17

Accepted Solution

by:
Tacobell777 earned 125 total points
ID: 10691686
You'll have to navigate away from the page first, if you look up cookies int he cf documents it will tell you why and how, its really helpful..

<cfcookie name="source_id" expires=Now> <!--- Notice no quotes around Now --->
<cflocation url="somepage.cfm">

And on somepage.cfm you have
<cfoutput>#IsDefined("cookie.source_id")#</cfoutput> <!--- Always returns "YES" --->
0
 
LVL 11

Expert Comment

by:hart
ID: 10693576
yes tacobell is correct say for  eg: in a logout scenario, mostly what i do is

when the user clicks on logout,
say i rtake him to a page called logout.cfm

in which i write

<cfcookie name = "source_id"  value = ""  expires = "NOW">    

<script language="javascript">
function LogOut()
{
  window.location.replace("Default.cfm");
}
setTimeout("LogOut()",500);

</script>


and after this i take him to the default page after a timeout, this is just to make sure

else you can just write
<CFLOCATION URL=""Default.cfm" ADDTOKEN="No">

Regards
Hart

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unsearchable in Google,Yahoo and Bing. 6 58
AWS Advice on using WHM/cPanel 1 69
Moving web servers into a DMZ? 3 49
Problem to go to Web page 2 100
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now