I’m trying to track down an issue on an ASP.NET v3.5 application where the HttpSession times out before its (default) 20 minutes. We’re seeing behaviour where the session is lost only a few minutes into a session, at random and with no discernible cause such as unhandled exceptions. As far as I can tell, the ASP.NET worker process is not dying, otherwise that would have explained the dropped session.
What approach should I use to monitor when the session is dropped? Is there some event I can listen to, or some other hook in the System.Web namespace?
Also, can someone confirm that the countdown to expiration is reset by web activity? That is, the session’s lifetime gets reset to the (default) 20 minutes each time the web client makes an HTTP GET or POST?
There is an Session_OnEnd event you can use.