What is the best approach to implement error handling in mvc
I am trying to build an application using asp.net MVC. I would need help in designing my application. What is the best approach to implement error handling in asp.net MVC application? Is it a good idea to use [handleError] attribute in all the action methods or i just need to use in global.asax fiile

gaurav pal179 reputationPosted Apr 30, 2016, 1:09 PM EDT
Method 1:- Simple way
Method 2:- Override “OnException” method
Method 3:- Using “HandleError” Attribute
Method 4:- Inheriting from “HandleErrorAttribute”
Method 5:- Handling HTTP errors
Method 6:- Global Error handling in MVC
The best is combination of “Method 4” and “Method 6”. Create error handling classeswhich inherit from “HandleErrorAttribute” class and decorate them respectively on controllers and action methods. So this takes care of errors happening on controllers and actions.
As a safety enable Global error handling as a fallback for any unexpected and unhandled errors byusing “Application_Error” event as described in “Method 6”.
Bhuvanesh MohankumarRank #310 · 8.1K reputationPosted May 3, 2016, 12:14 AM EDT
Hi Sanjeev,
If you are handling error using MVC assemblies, then you should maintain someUI to display error and user interactions.