Click here to Skip to main content
15,921,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I am facing a lot problem on session time out plz help he out..


My Problem is described below in two cases
1) when user login into application his session timeout is 10minutes.If the user is not doing any operations(i.e navigations)on application then after 9min user has to get notification saying that you session will expire in 1 minute plz click OK to continue.if he click OK then session time should extend with out POSTBACK.
2)In the application we have popup's like lookUp screens for searching.If user click on image it display a small popup at that time the parent page session has to disable and for popup session has to start.if user is not doing any operations on popup for 10 min.we have to show the notification after 9min stating that your session will expire in 1 min plz click OK to continue.The user notification is for child page not for parent page.After completion of work in child page he will click close button then we have to enable the session for parent page with out postback.


How is it possible plz help me out ...i am breaking my head from past 1 week onwards...
Posted

I would suggest:Not to use Session as it consume server resource unnecessarily.
http://oauth.net/[^] can be used as alternative which can be used to generate tokens,
which in turn can be stored in cookies.



If you want to go ahead with Session,

after each postback enable javascript timer for 9 minute.
after 9 min display the notification with message may be browser popup,and when user clicks "OK";
send ajax request to one of server page to keep alive the session.
 
Share this answer
 
v2
One way to do it
Use the JavaScript setInterval method to call a JavaScript function (that you create) every 30 seconds. When the JavaScript function has been called 18 times, use JavaScript alert method to display the warning message.

var intCount=0;
setInterval("YourFunctionToCount()",30000)

function YourFunctionToCount(){
intCount++
if (intCount==18) {
    window.alert ("Timeout Imminent");
    intCount = 0
    }
}

Remember to set intCount to 0 every time the user does any other activity on the page.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900