Last post Nov 06, 2013 10:13 PM by Angie xu - MSFT
Nov 04, 2013 06:21 AM|marco_ked2|LINK
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"))
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?
Nov 06, 2013 10:13 PM|Angie xu - MSFT|LINK
You could take a look at this article to learn how to add Custom Error Page in ASP.NET application,
1. Configuring error at the page level:
//This block will execute when there any error on the page and we can fetch the current context
HttpContext context = HttpContext.Current;
//This block will fetch current excpetion
Exception exception = context.Server.GetLastError();
//This block will write the custom error message on the page
//This will clear the error from the server and let the page finish
2. Configuring error at the application level.
3. Configuring error from configuration.
I think these methods are also available for you, please have a try on your side.