Error pages not found, throwing ELMAH error with Custom Error Pages

前端 未结 2 1508
广开言路
广开言路 2020-12-29 10:14

I\'ve made some modifications to Global.asax so that I can show custom error pages (403, 404, and 500) Here\'s the code:

    public class MvcApplication : Sy         


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-29 11:14

    Finally got it working to my satisfaction...

    The Elmah.Mvc package applies a "hidden" error handler. I've disabled this by adding the following line in web.config (the value was set to "false" by default from nuget install)

    
    

    So, now my errors propagate up to Application_Error and are logged by Elmah, bypassing the Elmah filter, and display the proper error page (not the one in /shared/error.cshtml)

提交回复
热议问题