I had some custom error handling code in Application_Error
, which was doing some logging and then handing off to my Error
controller action/view. I had a bizarre issue where sometimes - and only on my production server, not on my development machine - the error page would appear, but no error details were recorded in the log.
Asked
Active
Viewed 248 times
0

TylerH
- 20,799
- 66
- 75
- 101

Gary McGill
- 26,400
- 25
- 118
- 202
1 Answers
1
I spent several hours trying to figure this out, and it turns out that my error page was being invoked directly, without going through Application_Error
!
I saw a throwaway comment on another SO post that implied that this might happen with the HandleError
attribute - i.e. that it would look for a view called Error
, and simply render that, bypassing Application_Error
.
I was using Elmah.MVC, and so did not explicitly use the HandleError
attribute, because Elmah does this for you. However, it turns out that Elmah also does the straight-to-error-view thing too, because when I renamed my view (and controller action) to something else, everything started working as expected.
Just posting this in case it helps someone else...

Gary McGill
- 26,400
- 25
- 118
- 202