Sapna
How can I detect an ASP.NET expired session?
By Sapna in ASP.NET on Jan 25 2011
  • krishan kumar
    Jan, 2011 27

    I have a site where the session needs to timeout because of security
    concerns. I want to send the user back to the login page if the session is
    expired.

    Whats happening at the moment is that objects that exisit in the Session are
    being accessed when the session has expired.
    I know I could do an if Session["whatever"] != null or something similar to
    detect whether the object is or isnt empty but there are many objects that
    would need to be checked and I'll bet that some of them can be null quite
    legitimately 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
    }

    • 0
  • knights
    Jan, 2011 25


Most Popular Job Functions


MOST LIKED QUESTIONS