protected void Application_Error(Object sender, EventArgs e) { WebErrorHandler Handler = new WebErrorHandler(Server.GetLastError().InnerException); // *** If a log file is specified we want to log the error. if (App.Configuration.ErrorLogFile != "") { Handler.LogFileName = App.Configuration.ErrorLogFile; Handler.LogError(true); } // *** Retrieve the detailed String information of the Error string ErrorDetail = Handler.ToString(); // *** Optionally email it to the Admin contacts set up in WebStoreConfig if (App.Configuration.SendAdminEmail) WebStoreUtils.SendAdminEmail(App.Configuration.StoreName + "Error: " + Request.RawUrl,ErrorDetail); // *** Debug modes handle different error display mechanisms // *** 0 - default ASP.Net - depends on web.config settings // *** 1 - display a generic application error message with no error info // *** 2 - display a detailed error message with full error info independent of web.config setting if (App.Configuration.DebugMode == 2) { Server.ClearError(); MessageDisplay.DisplayMessage("Application Error",ErrorDetail ); return; } else if (App.Configuration.DebugMode == 1) { //Response.Clear(); Server.ClearError(); MessageDisplay.DisplayMessage("Application Error", "We're sorry, but an unhandled error occurred on the server. " + "The Server Administrator has been notified and the error logged.<p>" + "Please continue on by either clicking the back button and retrying your request or by returning to the home page.<p>" + "='" + App.Configuration.StoreBaseUrl + "'>Web Store Home Page"); return; } return; }I use a configuration class that holds a number of settings (stored in Web.Config) that determine how errors are managed. One of the settings ni there allows switching debug modes, so I can have default ASP.Net error handling, a custom application error (deployment mode) or a developer error message that displays information much like ASP.Net's default, but has additional info (and also does it regardless of the RemoteOnly setting in web.config - so I can see what's wrong remotely without editing web.config).