I have just installed Application insights into my .Net MVC web application. In the Web.config file it made several changes, one of which is
<httpModules>
...
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
Which seems fine to me. The problem is when the application throws an error we have custom page errors enable and normally the filterContext.ExceptionHandled = FALSE. However with this httpModules installed I am seeing it change to filterContext.ExceptionHandled = TRUE.
We utilise custom page errors via :
protected virtual void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute(), -10);
}
public class HandleErrorAttribute : FilterAttribute, IExceptionFilter
{
public void OnException(ExceptionContext filterContext)
{
if (filterContext.ExceptionHandled)
return;
}
}
Can anyone give me a reason why Application insight may be changing the ExceptionHandled status?