Solved

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

Posted on 2004-03-26
5
697 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

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

810 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