在过滤器中得到模型状态信息
public class DataValidateFilterAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { StringBuilder sb = new StringBuilder(); var modelStates= filterContext.Controller.ControllerContext.Controller.ViewData.ModelState; } }
Hold on, everything is possible.