Solved

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

Posted on 2004-03-26
5
700 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

717 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