Understanding ASP.NET MVC Lifecycle: Why is Model not available in ActionFilter?
问题 I have created the following Custom ActionFilter, when I try to access the Model in the following code, it is null: public class CustomPermissionCheckAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext context) { OrganisationBaseController orgBaseController = context.Controller as Controller; var vm = ((Controller)context.Controller).ViewData.Model as MyViewModel; // null // check if current user has permission to vm.OrganisationId base