Tuesday, January 6, 2009

session expire problem.

Hi,

In many application we want to live session aprox 2 - 10 Hrs. If we set session time out 10 Hrs then it is extra overload of server.
If we want to live one page then we can apply following idea for solve this problem. just do something with client browser.
so called javaScript for replace image on client borowser. this way session wil never expire on specefic page.or do work with iframes reload.

Second Idea to remove this idea is :-

1)Always create cookie when u add any records in session and write cookie
when session is null after time out in that condition read values from
cookie. in this way u find values after session time out.


In javaScript section:-


[script language="javascript" type="text/javascript"]

function AlwaysLive(imgName) {
myImg = document.getElementById(imgName);
if (myImg) myImg.src = myImg.src.replace(/\?.*$/, '?' + Math.random());
}
window.setInterval("AlwaysLive('imgReload')", 100000); //100 seconds


[/script]



HTML:
[img id="imgReload" width="1" height="1" src="images/close_btn.gif?" alt="" /]

you must save the ? with image extension.

Thanks
HelpOnDesk Team

No comments: