Enabling Session Variables ColdFusion Help

Session variables are also enabled using the CFAPPLICATION tag in the Applicaton. efm.template . Because session variables are tied to a particular application, a name must be specified in the CFAPPLICATION tag by using the NAME attribute. The SESSIONMANAGEMENT attribute must also be set to Yes. Optionally, you can set the session timeout period using the SESSIONTIMEOUT attribute. If you don’t specify a timeout period, the timeout will default to the settings in the ColdFusion Administrator. You also have the option of specifying whether to use cookies by using the SETCLIENTCOOKIES attribute. If you choose to prohibit the use of cookies, you must be prepared to pass both the CFIO and CFTOKEN variables through URL or form parameters on every template of your application. If these variables are not passed, you risk losing control of session and client management.

The following code shows the syntax of a CFAPPLICATION tag that has enabled session variables, allowed the use of cookies, and set a session timeout of 20 minutes.

SESSIONTIMEOUT-‘#CreateT;meSpan(O, 0, 20, 0)”)

Using the CF Administrator

You can use the ColdFusion Administrator to enable session variables as well as set their default and maximum timeout values. When you open the ColdFusion Administrator, select the Variables option under the Server section on the left-hand frame.

Enabling Session Management

Look at the third section of the ColdFusion Administrator screen, titled Session and Application Variables. This is where you can enable or disable the use of session variables on a server. If session variables are disabled, then session management cannot be used with any application on the server; even if you specify that the SESSIONMANAGEMENT attribute of a CFAPPLlCATION tag is set to Yes, you will still not be able to use session variables. You may choose not to enable session variables to reduce the amount of strain you put on the server’s RAM (session variables are stored in the server’s RAM).

Setting the Default and Maximum Timeout Values

In the Session and Application Variables section of the ColdFusion Administrator’s. Variables screen, you can also specify default and maximum timeouts fOf session variables. The default value applies to all applications on a particular server. Setting the SESSIONTIMEOUT attribute of the CFAPPLICA TION tag in a particular Application. cfm template can overwrite this default.

The maximum value refers to the maximum timeout value allowed for any application on a particular server. ColdFusion will not allow a session timeout period higher than this. Setting a higher session timeout value in a particular application will cause ColdFusion to use the Administrator’s maximum timeout value.

Posted on November 16, 2015 in Uncategorized

Share the Story

Back to Top
Share This