User Guide

Table Of Contents
Managing the client state 345
To use ColdFusion session variables without using cookies, each page must pass the CFID and
CFToken values to any page that it calls as part of the request URL. If a page contains any HTML
href a= links, cflocation tags, form tags, or cfform tags the tags must pass the CFID and
CFToken values in the tag URL. To use J2EE session management, you must pass the jsessionid
value in page requests. To use ColdFusion client variables and J2EE session variables, you must
pass the
CFID, CFToken, and jsessionid values in URLs.
ColdFusion provides the
URLSessionFormat function, which does the following:
If the client does not accept cookies, automatically appends all required client identification
information to a URL.
If the client accepts cookies, does not append the information.
The
URLSessionFormat function automatically determines which identifiers are required, and
sends only the required information. It also provides a more secure and robust method for
supporting client identification than manually encoding the information in each URL, because it
only sends the information that is required, when it is required, and it is easier to code.
To use the
URLSessionFormat function, enclose the request URL in the function. For example,
the following
cfform tag posts a request to another page and sends the client identification, if
required:
<cfform method="Post" action="#URLSessionFormat("MyActionPage.cfm")#>
Tip: If you use the same page URL in multiple URLSessionFormat functions, you can gain a small
performance improvement and simplify your code if you assign the formatted page URL to a variable,
for example:
<cfset myEncodedURL=URLSessionFormat(MyActionPage.cfm)>
<cfform method="Post" action="#myEncodedURL#">
Client identifiers and security
The following client identifier issues can have security implications:
Ensuring the uniqueness and complexity of the CFToken identifier
Limiting the availability of Session identifiers
The next sections discuss these issues.
Ensuring CFToken uniqueness and security
By default, ColdFusion uses an eight-digit random number in the CFToken identifier. This
CFToken format provides a unique, secure identifier for users under most circumstances. (In
ColdFusion MX, the method for generating this number uses a cryptographic-strength random
number generator that is seeded only when the server starts.)
However, in the ColdFusion MX Administrator, you can enable the Settings page to produce a
more complex
CFToken identifier. If you enable the Use UUID for cftoken option, ColdFusion
creates the
CFToken value by prepending a 16-digit random hexadecimal number to a ColdFusion
UUID. The resulting
CFToken identifier looks similar to the following:
3ee6c307a7278c7b-5278BEA6-1030-C351-3E33390F2EAD02B9