-
Notifications
You must be signed in to change notification settings - Fork 0
2. Basics
franciscoserdio edited this page Aug 9, 2016
·
2 revisions
-
You can create an intermediate class between System.Web.UI.Page and your web pages.
-
See TestWeb / App_Code / BasePage.cs
-
-
In this class, you can override the function
-
protected override void OnError(EventArgs e)
-
-
By this override, all unhandled errors will be processed
-
This function initiates the chain processing the error
protected override void OnError(EventArgs e) { if (ErrorProcessorChain.IsEnabled) { Exception realError = HttpContext.Current.Server.GetLastError(); while ( null != realError.InnerException ) { realError = realError.InnerException; } ErrorProcessorChain epc = ErrorProcessorChain.createErrorProcessorChain(); epc.ProcessError( realError, epc.Source, HttpContext.Current.Request.CurrentExecutionFilePath.ToString()); Server.ClearError(); } else { base.OnError(e); } }