User Guide

Table Of Contents
Configuring and using client variables 347
Choosing a client variable storage method
By default, Coldfusion stores client variables in the Registry. In most cases, however, it is more
appropriate to store the information as client cookies or in a SQL database.
The ColdFusion MX Administrator Client Variables page controls the default client variable
location. You can override the default location by specifying a This.clientStorage value in
Application.cfc or by setting the
clientStorage attribute in the cfapplication tag.
You can specify the following values for the client storage method:
Registry(default). Client variables are stored under the key HKEY_LOCAL_MACHINE\
SOFTWARE\Macromedia\ColdFusion\CurrentVersion\Clients.
Name of a data source configured in ColdFusion MX Administrator
Cookie
Generally, it is most efficient to store client variables in a database. Although the Registry option
is the default, the Registry has significant limitations for client data storage. The Registry cannot
be used in clustered systems and its use for client variables on UNIX is not supported in
ColdFusion MX.
Using cookie storage
When you set the client storage method to Cookie, the cookie that ColdFusion creates has the
applications name. Storing client data in a cookie is scalable to large numbers of clients, but this
storage mechanism has some limitations. In particular, if the client turns off cookies in the
browser, client variables do not work.
Consider the following additional limitations before implementing cookie storage for client
variables:
Any Client variable that you set after a cfflush tag is not sent to the browser, so the variable
value does not get saved.
Some browsers allow only 20 cookies to be set from a particular host. ColdFusion uses two of
these cookies for the
CFID and CFToken identifiers, 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 client-host pair.
Some browsers set a size limit of 4K bytes per cookie. ColdFusion encodes nonalphanumeric
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 throws an error if you try to
store more than 4,000 encoded bytes of data for a client.
Configuring database storage
When you specify a database for client variable storage, do not always have to manually create the
data tables that store the client variables.