User Guide

194 Developing Web Applications with ColdFusion
For information on setting time-outs for variables, See Administering ColdFusion
Server.
Differentiating client, session, and application variables
This table shows the relationships among client, session, and application variables.:
Note ColdFusion does not attempt to automatically evaluate application and
session variables. You must use variable prefixes with these variables, as
in Session.variablename or Application.variablename.
Using Session Variables
Use session variables when the variables are needed for a single site visit or set of
requests. For example, you might use session variables to store a user’s selections in a
shopping cart application. (Use client variables when the variable is needed for future
visits.)
What is a session?
A session refers to all the connections that a single client might make to a server in the
course of viewing any pages associated with a given application. Sessions are specific
to individual users. As a result, every user has a separate session and has access to a
separate set of session variables.
This logical view of a session begins with the first connection by a client and ends (after
a specified time-out period) after that client’s last connection. However, because of the
stateless nature of the Web, it’s not always possible to define a precise point at which a
session ends. In the real world, a session ends when the user finishes using an
application and goes off to do something else. In most cases, however, a Web
application has no way of knowing if a user is finished or if he’s just lingering over a
page.
You can impose some structure on session variable duration by specifying a time-out
period. If the user does not access a page of the application within this time-out
Kinds of Variables
Variable
Type
Application
Names
Client
IDs
Client
Mgmt
Session
Mgmt
Time-out
Client Optional Required Required n/a Optional
Session Optional Required Required Required Optional
Application Required n/a n/a n/a Optional