处理Application_Error global.asax中的异常

时间:2013-04-23 07:29:37

标签: asp.net global-asax application-error

我在Application_Error的全局文件中编写了代码 我在我的数据库中插入错误详细信息。
但有些人有时会插入相同错误的千条记录 这是否意味着Application_Error中存在错误 如果是,那我该怎么处理呢。

编辑1

插入错误后,我也会重定向到错误页面。

错误明细

Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.<br><br><br>
Inner Exception : System.NullReferenceException: Object reference not set to an instance of an object.

at System.Collections.Specialized.NameObjectCollectionBase.BaseGetKey(Int32 index)
at System.Collections.Specialized.NameObjectCollectionBase.BaseRemove(String name)
at System.Web.SessionState.SessionStateItemCollection.Remove(String name)
at InfoDomeWeb.UserControl.LeftPanel.SetCustomerInfo() in D:\Working Folder\InfoDome\InfoDomeWeb\UserControl\LeftPanel.ascx.cs:line 185
at InfoDomeWeb.UserControl.LeftPanel.Page_Load(Object sender, EventArgs e) in D:\Working Folder\InfoDome\InfoDomeWeb\UserControl\LeftPanel.ascx.cs:line 71
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)<br><br><br>Stack trace:    at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.error_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\961a93aa\98c42fe5\App_Web_304di5zu.12.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

页面上发生错误

D:\Working Folder\InfoDome\InfoDomeWeb\UserControl\LeftPanel.ascx.cs

但我没有发现任何问题。

0 个答案:

没有答案