65.9K
CodeProject is changing. Read more.
Home

Session time-out setting in ColdFusion

starIconstarIconstarIconstarIconemptyStarIcon

4.00/5 (1 vote)

Oct 28, 2014

CPOL

1 min read

viewsIcon

12263

Knowing how session time-out work in ColdFusion

Introduction:

We will know about the session timeout management in ColdFusion.

Use Cases:

Case : 1

In CF Admin Under Server Setting >> Memory Variables 

           The session timeout value was set to 30 mins

In My Application inside Application.cfc

           The session timeout value was set to 20 mins

Case : 2

In CF Admin Under Server Setting >> Memory Variables 

           The session timeout value was set to 20 mins

In My Application inside Application.cfc

           The session timeout value was set to 30 mins.

In the above 2 cases what would be the precendence of the session timeout values??
 
Answer:
      case : 1 - session timeout value would be 20 minutes
      case : 2 - session timeout value would be 30 minutes
 
Hence in both the cases the session timeout setting in CF Admin would be overwritten by the session timeout  setting provided inside Application.cfc in the Application.
 
So it is a good habit to set the Memory variables inside the Application.cfc for an Application.

 

Using the code:

// code block to use session timeout value
   <cfapplication 
        name = "My Application"
        sessionmanagement = "true"
        sessiontimeout = "#CreateTimeSpan(0,1,0,0)#"
        applicationtimeout = "#CreateTimeSpan(0,12,0,0)#">

The above code in Application.cfc will et the session timeout to 1 hour and the application timeout to 12 hours.(overriding the session and application timeout values those are set in CF Admin)