title: Retrieving Session in Global.asax
body: <p>This is the error I get
  "Session state is not available in this context."</p>
  
  <p>Just an amateur programmer, how can I retrieve Session in Global.asax</p>
  
  <p>this is my code in Global.asax</p>
  
  <pre><code>public class Global : System.Web.HttpApplication
  {
      protected void FormsAuthentication_OnAuthenticate(Object sender, FormsAuthenticationEventArgs e)
      {
          if (FormsAuthentication.CookiesSupported == true)
          {
              if (Request.Cookies[FormsAuthentication.FormsCookieName] != null)
              {
                  try
                  {            
                      string Email = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value).Name;
                      string Roles = LoginVerification.GetUserRoles(Email);
                      string DisplayName = (string)Session["DisplayName"];
                      e.User = new System.Security.Principal.GenericPrincipal(
                      new System.Security.Principal.GenericIdentity(DisplayName, "Forms"), Roles.Split(';'));
                  }
                  catch (Exception)
                  {
  
                  }
              }
          }
      }
  
      protected void Application_Start(object sender, EventArgs e)
      {
  
      }
  
      protected void Session_Start(object sender, EventArgs e)
      {
  
      }
  
      protected void Application_BeginRequest(object sender, EventArgs e)
      {
  
      }
  
      protected void Application_AuthenticateRequest(object sender, EventArgs e)
      {
  
      }
  
      protected void Application_Error(object sender, EventArgs e)
      {
  
      }
  
      protected void Session_End(object sender, EventArgs e)
      {
  
      }
  
      protected void Application_End(object sender, EventArgs e)
      {
  
      }
  }
  </code></pre>
  
  <p>Thank you in advance for answering my question! :)</p>