Hi,
i have noticed when using the action filters in mvc 6 the actually context controller definition is an object not of type Controller, i wanted to make sure the following is the correct new way we are now suppose to be using it, below is examples of the original method and the new.
original version method:
public override void OnActionExecuting(ActionExecutingContext filterContext) { filterContext.Controller.ViewBag.example = true; }
the new method in mvc 6 method of the same?
Note: ActionExecutingContext.controller is no longer of type "Controller" but an "Object" in mvc 6
public override void OnActionExecuting(ActionExecutingContext filterContext) { ((Controller)filterContext.Controller).ViewBag.example = true; }