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

On Fri, Mar 12, 2010 at 12:43 PM, Matthew Smith <[email protected]> wrote:
>
> Ok, just to clarify, does the count down restart with the load of
> application.cfm, or is it when a session variables is referenced?
>
> On Fri, Mar 12, 2010 at 9:42 AM, Mike Chabot <[email protected]> wrote:
>
>>
>> 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
>>
>> On Fri, Mar 12, 2010 at 10:22 AM, Matthew Smith <[email protected]>
>> wrote:
>> >
>> > 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!
>>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331689
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to