has anyone had an issue were ColdFusion session variables never timeout on a server?


i having issue on 1 of our production coldfusion 9 servers session variables never timing out.

 

i set simple page make sure i'm not missing something.

 

application.cfc page (i tried application.cfm well)

<cfcomponent>

<cfset this.name = "testapplication">
<cfset this.sessionmanagement=true>
<cfset this.sessiontimeout="#createtimespan(0,0,1,0)#">
<cfset this.applicationtimeout="#createtimespan(5,0,0,0)#">

<cffunction name="onapplicationstart">
<cfsetting showdebugoutput="yes" enablecfoutputonly="no">
</cffunction>
<cffunction name="onrequeststart">
<cfdump var="#this#">
</cffunction>
</cfcomponent>

 

index.cfm page

 

<cfif isdefined("session.timestamp")>
<cfdump var="#session#">
<cfdump var="#application#">

<cfoutput>#session.timestamp#</cfoutput>
<cfelse>
<cfset session.timestamp=now()>

</cfif>

 

the timestamp session variable never times out , once set first time. can leave page days , still won't time-out. maximum session timeout on server set 2 days. way rid of session variables clear cookies on browser.

 

has seen type of issue before?

tmike12345 wrote:

 

the timestamp session variable never times out , once set first time. can leave page days , still won't time-out. maximum session timeout on server set 2 days. way rid of session variables clear cookies on browser.

you should not expect custom session variable timeout. wont happen because contrary design of sessions.

 

what times out the session itself, rather variable in it. however, setting this.sessionmanagement=true implies coldfusion provide session whenever user opens page. so, session 1 may time out, new session 2 may start. it, too, may later time out if left idle while, giving way new session 3. whereas, variable session.timestamp may continue defined in session 3, once in session 1 , in session 2.

 

the obvious way verify whether session has timed out check a change in system variables session.cfid , session.cftoken. such change means beginning of new session. is, of course, 1 consequence of end of session.

 

you glad know application.cfc automatically knows when session has ended. onsessionend event fire when session ends. have included in following suggestions:

 

<cfcomponent>

<cfset this.name = "testapplication">
<cfset this.sessionmanagement=true>

<!--- session timeout set @ 20 30 minutes (comes studies on users on web) --->
<cfset this.sessiontimeout="#createtimespan(0,0,20,0)#">
<cfset this.applicationtimeout="#createtimespan(5,0,0,0)#">

<cffunction name="onapplicationstart">
<!--- page setting: not belong here--->

<!---<cfsetting showdebugoutput="yes" enablecfoutputonly="no">--->
</cffunction>
<cffunction name="onrequeststart">

<!--- bad practice display in application file--->
<!--- <cfdump var="#this#">--->
</cffunction>

 

<cffunction name="onsessionstart">

<cfset session.timestamp = now()>

</cffunction>

 

<cffunction name="onsessionend">

<cfargument name = "sessionscope" required="yes">

<cfargument name = "appscope" required="yes">

 

<cflog file="#this.name#" type="information" text="the session #arguments.sessionscope.sessionid# started @ #arguments.sessionscope.timestamp# , ended @ #now()#">

</cffunction>

</cfcomponent>

 

index.cfm page

 

<!--- setting this.sessionmanagement=true means session defined. there therefore no need test existence--->

<cfdump var="#session#">
<cfdump var="#application#">



More discussions in ColdFusion


adobe

Comments

Popular posts from this blog

Some mp4 files not displaying correctly (CS6)

Thread: Samba is not authenticating with LDAP