asp.net-mvc-3handleerror

Question reg. HandleError attribute in ASP.NET MVC 3


If I register the HandleError attribute in global.asax.cs file as below,

public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
    filters.Add(new HandleErrorAttribute());
}

still I need to specify the HandlError attribute in all the controllers?


Solution

  • No, you don't. That's the whole point of global filters.

    Global filters run for every action of every controller.

    MSDN