Session Variables


Session variables are persistent variables that are used to store information about a specific user session. Session variable values are stored in the ColdFusion Server memory and can therefore be accessed by any template within the ColdFusion application.

Session variables must be referred to using the session prefix. A session variable looks like this:

 session.DSN 

When session management is enabled within the CFAPPLICATION tag, the following session variables are created and defined uniquely for each user session:

  • Session.CFID. Sequential numeric ID created by the ColdFusion Server for each user session

  • Session.CFToken. A random alphanumeric string that combines with the CFID to form a unique identifier for each user session

  • Session.SessionID. A concatenation of the application name, CFID, and the CFTOKEN, which is used to identify each user session

  • Session.URLToken. A concatenation of CFID and CFTOKEN to be passed as a uniform resource locator (URL) parameter when the setclientcookies attribute of the CFAPPLICATION tag is set to No

Session variables are often used to hold user login information, shopping cart contents, or other session preferences. Session variables must be set with the session scope specifically defined:

 <cflock scope="session" type="exclusive" timeout="10">         <cfset session.User>  </cflock>  


Inside ColdFusion MX
Inside Coldfusion MX
ISBN: 0735713049
EAN: 2147483647
Year: 2005
Pages: 579

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net