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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

session time out/logoff 1

Status
Not open for further replies.

peter11

Instructor
Mar 16, 2001
334
0
0
US
I am using the following code to log a user off if their session times out.
It works great but the person does not know if they have timed out until they go to another page or hit refresh.

Is there a way to go to , <cflocation url=&quot;../login.cfm&quot;>, as soon as the session times out(not waiting for them to refresh the page?

<cfset bLoggedIn = False>

<cfif IsDefined(&quot;Session.UserID&quot;)>
<cfif Session.UserID neq &quot;&quot;>
<cfset bLoggedIn = True>
</cfif>
</cfif>

<cfif bLoggedIn eq False>
<cflocation url=&quot;../login.cfm&quot;>
<cfexit>
</cfif>
 
<!--- This code will send the user to a timeout page after 20 minutes --->
<script language=&quot;JavaScript1.2&quot;>
setTimeout('window.location.href=\&quot;/timeout.cfm&quot;',1200000);
</script>


Place this in your code. If it needs to work on every page of your site, use includes.
 
Will this send the user to the timeout page after 20 minutes or after the only after 20 minutes of not being used?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top