Session Time Extension
On windows authentication( intranet web application )
When the session is about to timeout, the client should be presented with a POP-UP that asks to click OK to extend the session or else cancel to timeout the session.
Which is the better way to accomplish this task. By Using Ajax Call开发者_Go百科 or By handling it in the code behind file when the session(userid) is nothing
You can simply place a timer on your page using javascript which prompts the user to press ok to reset the session's sliding expiration window. If they press yes then simply send a discrete http request to the server side in order to reset the session duration window. As far as when to show the popup I'd say a good few minutes before it's due to expire to be safe.
See the following stackoverflow post for information on how to keep the session ticking over. You would then simply implement your javascript dialog to support / call this example.
Keeping ASP.NET Session Open / Alive
精彩评论