I am sharing a simple solution for turning off Elmah sending emails for 404 Http Errors. I wanted elmah to still log the 404 errors in case we find some hackers trying to find some config files etc.
Asked
Active
Viewed 123 times
1 Answers
1
You need to add the following to your Web.config file:
system.web node:
<httpModules>
...
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
...
</httpModules>
configSections node:
<sectionGroup name="elmah">
<section name="errorFilter" type="Elmah.ErrorFilterSectionHandler, Elmah"/>
</sectionGroup>
elmah node:
<errorFilter>
<test>
<and>
<equal binding="HttpStatusCode" value="404" type="Int32" />
<regex binding="FilterSourceType.Name" pattern="mail" />
</and>
</test>
</errorFilter>

Rhys Stephens
- 889
- 3
- 20
- 36