2011-07-11 141 views
1

我的自定義錯誤處理程序返回:自定義錯誤處理程序返回不同的錯誤比一般錯誤處理程序

Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.

Source: System.Web

Stack Track: 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.inc_iframe_eventdetail_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\c30f285f\68ea8ff1\App_Web_g4uza9zi.4.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Target Site: Boolean HandleError(System.Exception)

然而,一般錯誤處理程序返回:

Server Error in '/' Application. Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Source Error:

Line 44: ChurchEventDataSource.SelectParameters.Add("ChurchEventId", Request.QueryString["EventId"]); Line 45: Line 46: EventFormView.DataBind(); Line 47: break; Line 48:

Source File: c:\Sites\Altruistic\ChurchFinder\Inc\Iframe\EventDetail.aspx.cs Line: 46

顯然,我要最詳細描述可能。

+0

這是***自定義錯誤處理程序的***代碼***和***通用錯誤處理程序***? 'Global.asax Application_Error'?和你的** web.config **關於'customerrors'和'httperrors' * sections *? –

回答

0

你的自定義錯誤處理程序在哪裏&你如何檢索異常。很可能你可能會使用HttpServerUtility.GetLastError方法來獲取異常 - 所以在這種情況下,使用InnerException屬性(如果不爲空)的實際異常對象 - 它將具有實際發生的異常。

+0

關閉,我在我的Global.asax中使用Server.GetLastError,但InnerException屬性*幾乎總是*在發生任何錯誤時都返回HttpUnhandledException。 – coderpros

+0

啊......想通了。當我應該使用.InnerException時,我正在使用.Message。 :|感謝您指點我正確的方向。 – coderpros

相關問題