Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

different session timeout values 1

Status
Not open for further replies.

actionbolt

Programmer
Dec 2, 2002
2
ZA
is it possible to have two different timeouts in a cfapplication, one if a user has not logged in to time out in 3 minutes and the other if a user has logged on to time out in 3 hours.

Ive tried using this but with no success please can someone help me.

<cfif isDefined(&quot;session.show&quot;)>
<cfset timeout = #createtimespan(0,0,3,0)#>
<cfelse>
<cfset timeout = #createtimespan(0,3,0,0)#>
</cfif>

<cfapplication name=&quot;company&quot; clientmanagement=&quot;Yes&quot; sessionmanagement=&quot;Yes&quot; sessiontimeout=&quot;#timeout#&quot;>
 
You might be able to. I have set up different timeout periods depending on the server the application is running on (devl vs. prod).

My code looks like this. Note the setclientcookies=&quot;Yes&quot; text, I didn't notice it in your code. Since cookies are used to stored the session variables, this may be important.
Code:
<cfif FindNoCase(&quot;devl&quot;, &quot;#CGI.HTTP_HOST#&quot;) is &quot;0&quot;>
	<cfapplication 	name=&quot;APP&quot;
			sessionmanagement=&quot;Yes&quot;
			setclientcookies=&quot;Yes&quot;
			sessiontimeout=&quot;#CreateTimeSpan(0,0,10,0)#&quot;
			applicationtimeout=&quot;#CreateTimeSpan(0,0,10,0)#&quot;>
<cfelse>
	<cfapplication 	name=&quot;APP&quot;
			sessionmanagement=&quot;Yes&quot;
			setclientcookies=&quot;Yes&quot;
			sessiontimeout=&quot;#CreateTimeSpan(0,0,30,0)#&quot;
			applicationtimeout=&quot;#CreateTimeSpan(0,0,30,0)#&quot;>
</cfif>

 
I don't understand why you'd want to time out a user if they aren't even in the application yet, but maybe you didn't explain the whole thing. Also, the SETCLIENTCOOKIES attribute defaults to yes, so unless you are passing your cfid and cftoken variables through the URL, you don't need to touch this variable (which should be set to NO in the latter case).

-Tek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top