我有一个ASP.NET应用程序,并在Global.asax“应用程序错误事件,我打电话给跟踪的方法/日志error.I想在这里使用会话变量的内容。我用下面的代码
void Application_Error(object sender, EventArgs e)
{
//get reference to the source of the exception chain
Exception ex = Server.GetLastError().GetBaseException();
//log the details of the exception and page state to the
//Windows 2000 Event Log
GUI.MailClass objMail = new GUI.MailClass();
string strError = "MESSAGE: " + ex.Message + "<br><br><br>" + "SOURCE: " + ex.Source + "<br>FORM: " + Request.Form.ToString() + "<br>QUERYSTRING: " + Request.QueryString.ToString() + "<br>TARGETSITE: " + ex.TargetSite + "<br>STACKTRACE: " + ex.StackTrace;
if (System.Web.HttpContext.Current.Session["trCustomerEmail"] != null)
{
strError = "Customer Email : " + Session["trCustomerEmail"].ToString() +"<br />"+ strError;
}
//Call a method to send the error details as an Email
objMail.sendMail("test@gmail.com", "myid@gmail.com", "Error in " + Request.Form.ToString(), strError, 2);
}
我在这行代码得到一个错误,我在哪里访问会话variable.Visual工作室,告诉
“会议是在此背景下可用”
如何摆脱呢? 有什么想法吗?
提前致谢