Coldfusion redirect to new URL when timeout

In application.cfc I set the time out as
           this.applicationTimeout = createTimeSpan(0,0,1,0);
           this.sessiontimeout = createTimeSpan(0,0,1,0);

How do I redirect the user to a new page in the application.cfc when timeout is triggered  ?
Errol FarroAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

When the session expires, nothing will happen on the user's page unless he/she tries to navigate to a new page.  Then you can test for a timeout and send them to a login page.

If you want the user's page to change automatically, like the banking websites do, and force a page change, this is done with javascript.    You need to use javascript to sleep some javascript code for the desired timeout period.   If reached, then a simple redirect to the login page would do it.  Be sure to have the login page clear out the previous login session to be sure you have logged them out.
Errol FarroAuthor Commented:
This is what I am looking for. How do I test for a timeout ?
I am not a javascript expert, but I think you just start a sleep function when your page loads.  That sleep function waits 20 minutes (or whatever your timeout is) and if it reaches the 20 minutes, the redirect action is performed.   If the user switches pages, then the function just starts over on the next page.  

Using this method, you are never actually checking the coldfusion session.   The CF session timeout exists as well (for backup lets say) in case of a js error or failure to load or if js is not enabled.   When you do the js rediect, you have to be sure to end the CF session, if you don't, the user could just hit back or navigate to a new page and still be logged in (unless the CF session has also expired at the same time).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
@Errol Farro - In your Application.cfc "OnRequest" Method you could perform some sort of session check. However, you must insure that you setup the session management properly in your app.

The snippet below is an example of a check that's perform with each page request. If the authorization session does not exist, the user is redirected back to a login page. This is all done using server side logic in this example:

<!--- If user has not logged in, force a login now --->  
	<cfif not isdefined("session.auth.IsLoggedIn")>	   
		<cfinclude template="LoginForm.cfm"> 

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.