ELMAH - Filtering 404 Errors ELMAH - Filtering 404 Errors asp.net asp.net

ELMAH - Filtering 404 Errors


It was indeed a configuration error, just not one that was particularly obvious.

The order in which the ELMAH HttpModules are registered is a pertinent concern because in order for ELMAH to filter the exception it must first know which modules will be consuming the exception. The ErrorFilter HttpModule must be registered last to prevent the other modules from processing the exception being filtered. This seems [kind of] backwards to me, but at least it works.

<configuration>  ...  <system.web>    <httpModules>      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>    </httpModules>  </system.web>  <system.webServer>    <modules>      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>    </modules>  </system.webServer></configuration>

After reviewing the ELMAH Wiki entry on ErrorFiltering again I discovered this little tidbit of information which really deserves a <strong /> tag, if you ask me. (Edit: They've bolded it since I first answered this question; props!)

The first step is to configure an additional module called Elmah.ErrorFilterModule. Make sure you add it after any of the logging modules from ELMAH, as shown here with ErrorLogModule: