How to get session in Global.asax

asp.net

Solution

Try accessing the value of session in HttpApplication.AcquireRequestState event using HttpContext.Current.Session

protected void Application_AcquireRequestState(object sender, EventArgs e)
{
  //Some code here
  string strYourKey = HttpContext.Current.Session["YourKey"].ToString();
}

Problem

I have value in Session UserID, I want to access this id in a function in global.asax if session expires i can get it in void Session_End(object sender, EventArgs e) other wise it showing error Session state is not available in this context What to do?

Original source