I have an action filter which (among other things), adds stuff to the RouteData. The value, however, is not picked up by the parameter in my action method. Any ideas why?
Action Filter:
public class SomeFilter : FilterAttribute, IActionFilter
{
public void OnActionExecuting(ActionExecutingContext filterContext)
{
var someData = new SomeClass();
//do stuff
filterContext.RouteData.Values["someData"] = someData;
}
}
Action Method:
[SomeFilter]
public ViewResult SomeActionMethod(SomeClass someData)
{
//someData is null here
}
Please note that the following line inside my action method does return something the data saved into it in action filter:
SomeClass isNotNull = RouteData.Values["someData"] as SomeClass;
Anyone knows why?