Detecting end of session with JS
Hello,
i'm using CF11,
part of my application.cfm file :
<cfapplication name="myapp" clientmanagement="yes" sessionmanagement="yes" sessiontimeout="#createtimespan(0,0,30,0)#">
When the user is logged in, session variable session.validlog is set to 1
The JS script (loaded with index.cfm) :
<script type="text/javascript">
function session_checking()
{
$.post("ajax-session.cfm", function(data) {
if(data === "-1")
{
window.location = "http:/myserver/login.cfm";
}
else
{
console.log('Session active') ;
}
});
}
var validateSession = setInterval(session_checking, 5000);
</script>
the ajax-session.cfm file :
<cfswitch expression="#session.validlog#" >
<cfcase value="1">1</cfcase>
<cfdefaultcase>0</cfdefaultcase>
</cfswitch>
So : every 5 sec ajax-session.cfm is executed, if it return -1, user is redirected to the login page.
Issue :
When application session timeout is coming to 0, the user is not redirected to the login page ...
Any idea ?
Thanks,
Marc
