House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

session variable timeout

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matthew Smith
03/12/2010 10:24 AM

I think I know this, but want to verify. If I do a isdefined on one session variable, is the timeout for all session variables reset? So if I have a isdefined("session.loggedin") check and it is true, I can assume that all session variables are still defined, assuming they were coming into that portion of the code? Thanks!

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
03/12/2010 10:41 AM

> If I do a isdefined on one session variable, is the timeout for all session > variables reset? No. The timeout is reset on every subsequent request by a user. > So if I have a isdefined("session.loggedin") check and it is true, I can > assume that all session variables are still defined, assuming they were > coming into that portion of the code? Generally, yes, unless you've done something to manipulate the contents of the Session scope. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bobby Hartsfield
03/12/2010 10:44 AM

I'd think yes since it was defined when the request was made. I think I know this, but want to verify. If I do a isdefined on one session variable, is the timeout for all session variables reset? So if I have a isdefined("session.loggedin") check and it is true, I can assume that all session variables are still defined, assuming they were coming into that portion of the code? Thanks!

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Mike Chabot
03/12/2010 10:44 AM

Kinda and yes. Simply accessing the page within the timeout limit should maintain the session. Your code in the second question should be an adequate check of whether or not the session is active. All session variables inside the user's session would expire at the same time. StructKeyExists(session,"loggedin") is more efficient than IsDefined(). -Mike Chabot ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matthew Smith
03/12/2010 12:45 PM

Ok, just to clarify, does the count down restart with the load of application.cfm, or is it when a session variables is referenced? ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
03/12/2010 12:56 PM

> Ok, just to clarify, does the count down restart with the load of > application.cfm, or is it when a session variables is referenced? It restarts on every subsequent request made by that browser. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Mike Chabot
03/12/2010 01:41 PM

The timer is reset when the session object is referenced, which happens on every page request. ColdFusion touches the session object on every ColdFusion page request, even if you don't specifically do this in your code. The session timer is not reset if you access file types that aren't served by CF, such as HTML files. There are some hidden functions which allow you to list out every session for every user within the application, not just the current session for the current user. So you could see, for example, that there are 20 active sessions on your server and you can see details about each session. One side effect of making use of this unofficial ability is that all the timers for all the user session get reset when you list them out like this, simply because you touched every session in order to list them out. Below is a CFC function that you can ping every X minutes from inside of an Adobe Flex app in order to keep the session alive on the ColdFusion server. Notice how the function is empty, yet it does the job. <cffunction name="keepSessionAlive" access="remote" output="no">   <!--- Do nothing here ---> </cffunction> -Mike Chabot ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group

<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

July 31, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
         1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31