User Guide

Configuring and Using Client Variables 223
Configuring and Using Client Variables
To use Client variables effectively, you set up the Client variable options and use the
variables on your ColdFusion pages.
Setting up Client variable options
If you want to enable Client variables, you must do so on every page in an
application. Because
the Application.cfm file is included in all of the applications
pages, you enable client management in the
cfapplication tag, at the beginning of
Application.cfm.
To enable client state management:
1 Open the file Application.cfm in ColdFusion Studio and modify it so that it
appears as follows:
<!--- This example illustrates cfapplication --->
<!--- Name the application and enable client management--->
<cfapplication NAME="SearchApp"
clientmanagement="Yes">
2 Save the file as Application.cfm in the root directory of your application
framework.
Choosing a Client variable storage method
After you enable client state management, you must determine where you want to
store Client variables. The system-wide default is to store Client variables in the
Registry. But you can choose to store them instead in a SQL database or in cookies.
The ColdFusion Administrator Server Client Variables page controls the default
Client variable location. You can override the default location by specifying a
clientstorage attribute in the cfapplication tag.
You can specify the following values in the
clientStorage attribute:
Registry(the default)
Name of a data source configured in the ColdFusion Administrator
Cookie
As a general rule, it is most efficient to store Client variables in a database.
Cookie storage
When you set clientstorage="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. Chief among them is that
if the client turns off cookies in the browser, Client variables do not work.