ErrorHandling.CustomSendErrorNotification Event

Occurs before determining whether it is possible to send the error alert to the application administrator.

Namespace: DevExpress.ExpressApp.Web

Assembly: DevExpress.ExpressApp.Web.v18.2.dll


public static event EventHandler<CustomSendErrorNotificationEventArgs> CustomSendErrorNotification
Public Shared Event CustomSendErrorNotification As EventHandler(Of CustomSendErrorNotificationEventArgs)

Event Data

The CustomSendErrorNotification event handler receives an argument of the CustomSendErrorNotificationEventArgs type.


The CustomSendErrorNotification event is raised as a result of invoking the ErrorHandling.SendAlertToAdmin method. By default, the e-mail message with error details is sent to a recipient specified in the Web.config file when an error occurs (see Error Handling in ASP.NET and Mobile Applications). You can customize this behavior by subscribing to this event in the ASP.NET application's Application_Start method. For instance, you can implement your own notification mechanism (via instant messaging, etc.), or cancel sending notifications in specific cases. The handler's Handled parameter cancels sending the default notification. Do not forget to unsubscribe from the CustomSendErrorNotification in the Application_End method. The following snippet illustrates how to ignore exceptions from the Security System (unsuccessful login attempts, etc).

protected void Application_Start(Object sender, EventArgs e) {
    ErrorHandling.CustomSendErrorNotification += ErrorHandling_CustomSendErrorNotification;
    // ...
private void ErrorHandling_CustomSendErrorNotification(
    object sender, CustomSendErrorNotificationEventArgs e) {
    if (e.Exception.Source.StartsWith("DevExpress.ExpressApp.Security.")) e.Handled = true;
protected void Application_End(Object sender, EventArgs e) {
    // ...
    ErrorHandling.CustomSendErrorNotification -= ErrorHandling_CustomSendErrorNotification;

If you want to use e-mail notifications supplied by default, but need to customize their options, handle the ErrorHandling.CustomSendMailMessage event instead of this event.

See Also