How can I detect an ASP.NET expired session?
Sapna
I have a site where the session needs to timeout because of securityconcerns. I want to send the user back to the login page if the session isexpired.Whats happening at the moment is that objects that exisit in the Session arebeing accessed when the session has expired.I know I could do an if Session["whatever"] != null or something similar todetect whether the object is or isnt empty but there are many objects thatwould need to be checked and I'll bet that some of them can be null quitelegitimately without needing the user to sign in again.Question: Is there a way of doing something like:if(Session.IsExpired){// Redirect to login}else{// Continue}
Check the following
http://www.eggheadcafe.com/community/aspnet/17/10239034/sessions.aspx