
224
Chapter 12 Using the Application Framework
Consider these additional limitations before implementing cookie storage for Client
variables:
•
Many browsers allow 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.
•
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 4000 encoded bytes of
data for a client.
Specifying Client variable storage in Application.cfm
The following example shows how to enable Client variable management using a
sample database called mydatasource.
To specify the Client variable storage method:
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"
clientstorage="mydatasource">
2
Save the file as Application.cfm in the root directory of your application
framework.
Note
Client storage mechanisms are exclusive; when one storage type is in use, the values
set in other storage options are unavailable.
Using Client variables
When you enable Client variables for an application, you can use them to keep track
of long-term information that is associated with a particular client.
Creating a Client variable
To create a Client variable and set the value of the parameter, use the
cfset
or
cfparam
tag; for example:
<cfset Client.FavoriteColor="Red">
After you set a Client variable in this manner, it is available for use within any page in
your application that is accessed by the client for whom the variable is set.
Содержание COLDFUSION 5-DEVELOPING
Страница 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Страница 58: ...38 Chapter 3 Querying a Database ...
Страница 134: ...114 Chapter 7 Updating Your Database ...
Страница 210: ...190 Chapter 10 Reusing Code ...
Страница 232: ...212 Chapter 11 Preventing and Handling Errors ...
Страница 238: ...218 Chapter 12 Using the Application Framework ...
Страница 262: ...242 Chapter 12 Using the Application Framework ...
Страница 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Страница 320: ...300 Chapter 15 Indexing and Searching Data ...
Страница 336: ...316 Chapter 16 Sending and Receiving E mail ...
Страница 374: ...354 Chapter 18 Interacting with Remote Servers ...