Application_Error中捕获Global.asax +未知错误

时间:2012-12-30 18:56:44

标签: asp.net exception-handling

当我启动程序时,我会立即在日志文件中记录“文件不存在”错误。然后,我尝试创建一个没有任何母版页但仍然收到此错误的干净Web表单,奇怪的是,但对我来说可能是好的,它不执行重定向,就像捕获的常见异常一样。从记录的文件中,我无法从消息中分辨出任何内容。有人有线索吗?感谢。

 void Application_Error(object sender, EventArgs e)
        {
            // Code that runs when an unhandled error occurs       
            Exception objErr = Server.GetLastError().GetBaseException();
            log.Error(objErr.Message, objErr);
            Response.Redirect("~/error.aspx");
        }

ERROR 11 GoogleMap_AutoFill_with_Obtain_LatLong.Global - File does not exist.
System.Web.HttpException (0x80004005): File does not exist.
   at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response)
   at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath)
   at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

0 个答案:

没有答案