Do Filter-Overrides work in the current RC (MVC 5.0.0 RC 1)

Topics: ASP.NET MVC
Aug 31, 2013 at 6:44 PM
Hi,

do Filter-Overrides work in the current RC ?

When I try to execute the action-method in the following listing, the DemoActionFilter, which extends FilterAttribute and inherits IActionFilter is executed although the action-method is annotated with OverrideActionFiltersAttribute.

What's wrong here?

Wishes,
Manfred
[DemoActionFilter]
public class HomeController : Controller
{

    [OverrideActionFiltersAttribute]
    public ActionResult Contact()
    {
        ViewBag.Message = "Your contact page.";

        return View();
    }
}
Sep 27, 2013 at 10:20 AM
Sep 27, 2013 at 5:51 PM
Yes, it's a bug. In MVC (unlike Web API), filters need to inherit from FilterAttribute (not just Attribute) if they want to be able to be applied via an attribute.

I've filed the bug:
https://aspnetwebstack.codeplex.com/workitem/1315