Pregunta

I have a web site mvc4 c# using elmah error logging. in my web config I declared email send on error from elmah and error filtering in code in global.asax :

void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
{
    if (e.Exception.GetBaseException() is InvalidOperationException)
    {
       if (e.Exception.Message.StartsWith("The connection id is in the incorrect format"))
           e.Dismiss();
     }
}

when I go to my http://mydomain/elmah.axd I see no more errors that got filtered. but I get them to mail.

i.e - if the application has error ""The connection id is in the incorrect format" ,I get notify on email by elmah, and I don't want to be notify ... is there a way to filter it also in mail notifications ?

¿Fue útil?

Solución

I had the same issue. You have to define a second function to filter out the Emails separately. The signature of this function is:

void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
{
}

Calling e.Dismiss() within this method will prevent the Exception from being e-mailed.

See https://code.google.com/p/elmah/wiki/ErrorFiltering

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top