में प्रवेश सत्र चर मैं ASP.NET अनुप्रयोग और Global.asax 'अनुप्रयोग त्रुटि इवेंट में है, मैं पता लगाने के लिए एक विधि बोल रहा हूँ/log error.I सत्र का उपयोग करना चाहते चर सामग्री यहाँ मैं नीचे दिए गए कोडASP.NET: Global.asax
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("[email protected]", "[email protected]", "Error in " + Request.Form.ToString(), strError, 2);
}
मैं कोड की पंक्ति में एक त्रुटि हो रही है जहाँ मैं सत्र variable.Visual स्टूडियो कह रहा है कि
"सत्र उपलब्ध नहीं है तक पहुँचने हूँ इस्तेमाल किया इस संदर्भ में "
इससे कैसे छुटकारा पाएं? कोई विचार?
अग्रिम
त्रुटि कहां से फेंक दी जा रही है? एएसपीएक्स कोड बीआईंड (कौन सा इवेंट?) में, या एक http हैंडलर आदि में? यह निर्धारित कर सकता है कि सत्र ऑब्जेक्ट का उपयोग मान्य है या नहीं – JonoW