Link to home
Start Free TrialLog in
Avatar of Errol Farro
Errol FarroFlag for Aruba

asked on

Coldfusion graceful timeout

After a user logs in, he is directied to to page1.cfm.
From page 1.cfm user can go to page2.cfm and session.page2 is created. From page2.cfm use can go to page3.cfm and session.page3 is created.

Now, if a user times out, let's say in page3.cfm, Coldfusion leave the URL on page3.cfm

After user logins again, user is directed to page3.cfm but gets an error because session.page3 does not exist.

How can I solve this problem ? I would like user to get the URL of page1.cfm after a time out.

Below please find  my application.cfc

<cfcomponent>

      <cfscript>
           this.name = "Adminpanel";
           this.applicationTimeout = createTimeSpan(0,0,15,0);
           this.clientmanagement= "yes";
           this.loginstorage = "session";
           this.sessionmanagement = "yes";
           this.sessiontimeout = createTimeSpan(0,0,15,0);
           this.setClientCookies = "yes";
           this.scriptProtect = "all";
           this.datasource = "cdmdata";
       </cfscript>



</cfcomponent>
Avatar of gdemaria
gdemaria
Flag of United States of America image

At the top of  page3.cfm, just test for the existence of session.page3

<cfif NOT isDefined("session.page3")>
     go to login
</cfif>
Avatar of Errol Farro

ASKER

Thanks for your response. In this example I put one session variable for clarity, but page3.cfm may have multiple session variables. Your suggestion to try out <cfif NOT isDefined("session.page3")> is a good approach. However, is there like a global catch for all the defined session variables ? Or as soon as the time out activates, can one redirect the to page1.cfm from application ?
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial