Model availability inside ActionFilter
Posted
by Sayed Ibrahim Hashimi
on Stack Overflow
See other posts from Stack Overflow
or by Sayed Ibrahim Hashimi
Published on 2010-03-15T03:39:23Z
Indexed on
2010/03/15
3:49 UTC
Read the original article
Hit count: 631
I have created a new ActionFilter for an ASP.NET MVC application that I'm creating. I have an action which accepts an Http Post and the argument of the action method accepts an object, for which I have created and registered a custom model binder.
I noticed that inside the IActionFilter.OnActionExecuting
the value for filterContext.Controller.ViewData.Model
is always null
despite the fact that it looks like the model binder is always invoked before the action filter OnActionExecuting
method. In contrast to this inside the IActionFilter.OnActionExecuted
method of the same action filter the value for filterContext.Controller.ViewData.Model
is not null.
Do you guys know if this is by design or a bug? If by design are their any links which describe why this is? Thanks.
© Stack Overflow or respective owner