Solved

Setting a 20 minute expiration on a cfcookie

Posted on 2009-05-07
1
946 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.

Question has a verified solution.

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

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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

808 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