Name

cfcookie

Synopsis

<cfcookie>

Writes a cookie to the user’s browser. Due to the way ColdFusion assembles dynamic pages, you shouldn’t attempt to use the cflocation tag within a template after a cookie variable has been set. In versions of ColdFusion prior to MX, setting a cookie variable and using cflocation afterward resulted in the cookie not being set. This is no longer the case in ColdFusion MX.

Attributes

name=" cookie_name "

Name of the cookie to write. Cookie names can consist of any printable ASCII characters with the exception of commas, semicolons, and whitespace characters. Required.

value=" value_of_cookie "

The value to assign the cookie. Required.

domain=" domains "

The domain for which the cookie can be read and written. Entries must always start with a dot. For example, domain=".oreilly.com" is a valid entry. Multiple entries may be separated by semicolons. Optional.

expires=" time_period "

The cookie’s expiration date. May be specified as a date, number of days, Now, or Never. Optional. If no value is provided for expires, the cookie is set as an in-memory-session-only cookie. This means that the cookie is never written to the user’s hard drive and automatically expires when the browser is closed.

path=" URLs "

The URLs in domain that the cookie applies to. Multiple entries can be separated by semicolons. Optional.

secure="Yes|No"

Whether the cookie must be transmitted securely via SSL. Optional. The default is No.

Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.