User Guide

190 Developing Web Applications with ColdFusion
Cookie storage
When you set CLIENTSTORAGE="Cookie" the cookie that ColdFusion creates has the
application’s name. Storing client data in a cookie is scalable to large numbers of
clients, but this storage mechanism has some limitations. Chief among them is that if
the client turns off cookies in the browser, client variables won’t work.
Consider these additional limitations before implementing cookie storage for client
variables:
Netscape Navigator allows only 20 cookies from a particular host to be set.
ColdFusion uses two of these cookies for CFID and CFTOKEN, and also creates
a cookie named CFGLOBALS to hold global data about the client, such as
HitCount, TimeCreated, and LastVisit. This limits you to 17 unique applications
per host.
Netscape Navigator sets a size limit of 4K bytes per cookie. ColdFusion encodes
non-alphanumeric data in cookies with a URL encoding scheme that expands
at a 3-1 ratio, which means you should not store large amounts of data per
client. ColdFusion will throw an error if you try to store more than 4000
encoded bytes of data for a client.
Managing Client State in a Clustered Environment
To maintain your ColdFusion Web application’s state in a clustered environment, you
can use server-side client variables that get stored in a common, back-end repository
that all Web servers in a multi-server clustered environment can access. Even though
all state information will be stored in client variables in the repository, a mechanism
must be used to identify specific client requests. This is typically accomplished by
dropping a client-side identifier, such as a cookie, on the user’s machine.
ColdFusion 4.5 provides several client variable attributes in the CFApplication tag that
allow you to maintain application state across a cluster when using server-side client
variables. These attributes enable client variable management and set CFID and
CFTOKEN cookies at the domain level (for example, .allaire.com). If ID and token
combinations already exist on each host in the cluster, ColdFusion migrates the host-
level cookies on each cluster member to the single, common domain-level cookie.
Following the setting or migration of host-level cookies to a domain-level cookie,
ColdFusion creates a new cookie (CFMAGIC) that tells ColdFusion that domain
cookies have been set.
This domain-level cookie allows a ColdFusion application to maintain specific client
information across a server cluster.
Using Client State Management
When client state management is enabled for an application, you can use the system
to keep track of any number of variables associated with a particular client.