User-1956618660 posted
I set up healthmonitoring in web.config to send email for unhandled exception and it's working fine.
I want to prevent it to send email for a certain specific error.
I put in global.asax the following code:
protected void Application_Error(Object sender, EventArgs e)
{
System.Exception exc = Context.Server.GetLastError();
if (exc.Message.Contains("my error message"))
{
Context.Server.ClearError();
}
}
That I thought it'd block email, but I still receiving it.
I know (by debug) that Server.ClearError() is executed.
Maybe I'm missing something.... Can anybody help?