I am also facing the same problem. When model binding has invalid data, it starts before ActionFilter (s).
I did not like the proposed solutions because the mess with routing was not my preferred solution. Listening to Application_AcquireRequestState is problematic because this event fires for every request, and not just for requests that will be routed to MVC controllers.
In the end, I wrote a custom implementation of IControllerFactory that uses the DefaultControllerFactory internally and executes the localization code inside the CreateController method.
This is not ideal either, hope this helps.
public class PluggableControllerFactory : IControllerFactory { private readonly IControllerFactory innerControllerFactory; public PluggableControllerFactory() { innerControllerFactory = new DefaultControllerFactory(); } public IController CreateController(System.Web.Routing.RequestContext requestContext, string controllerName) {
Ido ran
source share