Solved

Setting a 20 minute expiration on a cfcookie

Posted on 2009-05-07
1
876 Views
Last Modified: 2013-12-24
I see from the documentation for cfcookie that the expration can be set via the Expires field:

http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-a18.htm

It pretty self explanatory if I want the cookie to remain for a few days, but when it comes to a few mintues how do I go about that?

Specifically I want to set a cookie to expire in 20 minutes and I would like the sample code to do that.
0
Comment
Question by:onaled777
1 Comment
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 24325433
Check this:
<cfcookie name = "ExpireTimeDemo"

   value = "#TimeFormat(DateAdd("n",20,NOW()))#"

   expires = "#DateAdd("n",20,NOW())#"> 
 

<script>

alert(unescape(document.cookie));

</script>

Open in new window

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.

Join & Write a Comment

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
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 video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

21 Experts available now in Live!

Get 1:1 Help Now