When I have my custom errors disabled, Elmah is taking all exceptions that occur and logging them into my database and emailing me.
However, the second I change my web.config to:
<customErrors mode="RemoteOnly" defaultRedirect="~/Home/Error">
</customErrors>
Elmah stops functioning. It no longer logs exceptions to the database or anything, all I see is my custom error action being executed.
How can I have custom error messages and still have elmah log exceptions? I am currently not doing any other exception intercepting besides Elmah.
Build the application, run it in the browser, and navigate to http://www.yoursite.com/elmah.axd. You are prompted to log in before you see the content. After a successful authentication, you see a web page to remotely view the entire log of recorded exceptions.
In this article ELMAH is a free, open source error logging library that includes features like error filtering and the ability to view the error log from a web page, as an RSS feed, or to download it as a comma-delimited file.
Figured it out!
The reason this was occurring was because I had filters.Add(new HandleErrorAttribute());
in Global.asax
. I don't know why this is there, but that was what was causing this to fail when custom errors was enabled. Removing this line caused Elmah to work properly with custom errors.
Also, telling elmah to log "handled" errors also works, as described by this answer.
I don't truely know the full ramifications of either option though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With