This could be a silly/lame question, especially after working so long with ASP.NET :), but I need to be sure.
Is it possible to have session (that is ASP.NET session) outlive the Application (app instance/app domain/Application variable)?
In other words, if Application_End is called in the Global.asax, does it indicate that there will be no more active session? and any new request will result in a Application_Start followed by an new Session_Start?
Note, the Session may not always be InProc, the session could be in a State server or SQL server.
With the default InProc
session state, the application will terminate when the last session has expired, at which point Application_End
occurs. In this scenario the entire appDomain
is torn down and all memory freed. As sessions are persisted in memory they are permanently destroyed at this point, and therefore can never live beyond the life of the application.
If using Sql Server
or State Server
where the session is stored on a separate machine, then when the application is torn down the sessions can continue to live. Then because the client retains the original session cookie in the browser, the next time they visit the site the session is restarted, and sessionid
used to identify their existing session.
Yes, when you put the state in SQL Server the application could restart but you will still maintain the session state
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With