I have an ASP.NET application and in the Global.asax \' Application Error Event, I am calling a method to trace/log the error. I want to use the session variable content her
It should work if you do it like this:
strError = System.Web.HttpContext.Current.Session["trCustomerEmail"]
Because that is what I do myself.
What exactly do you mean with: Visual Studio is telling that "Session is not available in this context"? Do you get a compiler error or a run-time exception?
You could try to be more defensive and test if there actually is a current HttpContext and a Session:
if (HttpContext.Current != null &&
HttpContext.Current.Session != null) {
strError = HttpContext.Current.Session["trCustomerEmail"]
}