MVC HandleError filter didn't catch an exception

前端 未结 1 1645
忘了有多久
忘了有多久 2020-12-21 12:29

I\'ve an MVC 3 web app in which I\'m using \"HandleError\" Action Filter for exception handling. I\'ve this action filter implemented as follows:

         


        
相关标签:
1条回答
  • 2020-12-21 13:10

    Is it possible for any sort of errors to escape this action filter?

    HandleError filter doesn't catch all the exceptions fired in an application. It can capture exceptions that are fired inside actions, action filters.. simply inside the MVC context. Also it doesn't capture HTTP exceptions having status code other than 500. Relying only on HandleError filter in an MVC application is a bad idea.

    You should still rely on the Application_Error event to do some logging and customErrors section to display a custom error page for the exceptions that are not captured by HandleError.

    I've written a blog post on this subject that may help you.

    0 讨论(0)
提交回复
热议问题