I'm Using Session
Value in Master page by using
sessionTimeout = <%= Session.Timeout %> ;
SessionTimeout=20
I'm using this function to decrease the session value.
sessionTimeout = <%= Session.Timeout %> ;
now = new Date();
newtime = now.setMinutes(now.getMinutes() + parseInt(sessionTimeout));
function Session_Expiry(session1) {
now = new Date();
diff = newtime - now;
days = Math.floor(diff / (1000 * 60 * 60 * 24));
hours = Math.floor(diff / (1000 * 60 * 60));
mins = Math.floor(diff / (1000 * 60));
secs = Math.floor(diff / 1000);
mm = mins - hours * 60;
ss = secs - mins * 60;
if(mm<10 && mm>=0)
{
mme='0'+mm;
}
else
{
mme=mm;
}
if(ss<10 && ss>=0)
{
sse='0'+ss;
}
else
{
sse=ss;
}
sessionresult ='Session will expiry in '+ mme + ':' + sse + ' Secs';
document.getElementById(session1).innerHTML = sessionresult;
if(secs<=0)
{
window.location.href='Login.aspx';
}
setTimeout('Session_Expiry("'+session1+'");','1000');
return true;
}
and i'm decrementing this value,by using java script. It is working fine. but when i redirect
to another page the session
value is staring from 20. How can i resist this, I want the output , when i redirect to another content page of master page
, the session value has to be start with the previous value, not from initial value.
Thanks in advance.