title: ASP.NET MVC session is null. Session Variables are not being set
body: <p>I have the following code in my Global.asax</p>
  
  <pre><code>protected void Application_AcquireRequestState(object sender, EventArgs e)
  {           
      if (HttpContext.Current.Handler is IRequiresSessionState)
      {
          if (Request.IsAuthenticated)
          {
              if (HttpContext.Current.Session[this.MemberShipProvider.PrincipalSessionKey] != null)
              {
                  CxPrincipal principal;
                  try
                  {
                      principal = (CxPrincipal)HttpContext.Current.Session[this.MemberShipProvider.PrincipalSessionKey];
                  }
                  catch
                  {
                      principal = null;
                  }
  
                  HttpContext.Current.User = principal;
                  Thread.CurrentPrincipal = principal;
              }
              else
              { 
                  var identity = new CxIdentity("admin", 1, "", true);
                  CxPrincipal principalLogin = new CxPrincipal(identity, 1);
                  HttpContext.Current.Session[this.MemberShipProvider.PrincipalSessionKey] = principalLogin;
                  HttpContext.Current.Session[SessionName.CurrentUser] = "Admin User";
                  HttpContext.Current.User = principalLogin;
                  Thread.CurrentPrincipal = principalLogin;
                  this.FormServiceProvider.SignIn("admin", false); // this is equal to FormsAuthentication.SetAuthCookie
  
              }
          }
      }
  }
  </code></pre>
  
  <p>The problem is that everytime the Session is object is null. Not only here, I can't use sessions in my application as well. Either the session is being Reset or something like that. </p>
  
  <p>My application doesn't require the user to Login anymore. Therefore I am not using Session.Clear or Session.Abandon any where in my application.</p>
  
  <p>Please help me, why is my session variable not setting?</p>