Storing Session Data In Session Variables; Standard Session Variables - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

Enabling session variables in your application
You must also enable session variables in the
the following in the Application.cfm file to enable session variables:
Set
sessionManagement="Yes"
Use the
name
Optionally, use the
value. Use the
seconds for the time-out.
The following sample code enables session management for the GetLeadApp application and sets
the session variables to time out after a 45-minute period of inactivity:
<cfapplication name="GetLeadApp"
sessionmanagement="Yes"
sessiontimeout=#CreateTimeSpan(0,0,45,0)#>

Storing session data in session variables

Session variables are designed to store session-level data. They are a convenient place to store
information that all pages of your application might need during a user session, such as shopping
cart contents or score counters.
Using session variables, an application can initialize itself with user-specific data the first time a
user accesses one of the application's pages. This information can remain available while that user
continues to use that application. For example, you can retrieve information about a specific user's
preferences from a database once, the first time a user accesses any page of an application. This
information remains available throughout that user's session, thereby avoiding the overhead of
retrieving the preferences repeatedly.

Standard session variables

If you use ColdFusion session variables, the Session scope has four built-in, read-only variables
that your application can use. If you use J2EE session management, the Session scope has two
built-in variables. Generally, you use these variables in your ColdFusion pages only if your
application supports browsers that do not allow cookies. For more information on supporting
browsers that do not allow cookies, see
on page
319. The following table describes the built-in session variables.
Variable
Session.CFID
Session.CFToken
328
Chapter 15: Using Persistent Data and Locking
attribute to specify the application's name.
sessionTimeout
function to specify the number of days, hours, minutes, and
CreateTimeSpan
Description
ColdFusion session management only: the client ID, normally stored on the
client system as a cookie.
ColdFusion session management only: the client security token, normally
stored on the client system as a cookie.
tag in your Application.cfm file. Do
cfapplication
attribute to set an application-specific session time-out
"Using client and session variables without cookies"

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents