Why isn’t session state available?

Platform: ASP.NET|Category: Session
  • – First, check your web.config, machine.config and your page directive to make sure you have enabled session state.
    Reference:

  • – session state is not available just everywhere, anytime. It is available only after the HttpApplication.AcquireRequestState event is called. For example, it is NOT available in the Application_OnAuthenticateRequest handler inside global.asax.
    For details, see: Handling Public Events

  • – Lastly, make sure System.Web.SessionState.SessionStateModule is included the in your config files. A common case is that SharePoint application will remove this module from their web.config files (for performance reason), and thus session state isn’t available.