在AuthorizationHandler中访问ModelState

时间:2020-10-19 15:38:30

标签: asp.net-core .net-core

我正在尝试访问AuthorazationHandler中的ModelStateGET动作触发处理程序:

var httpContext = _httpContextAccessor.HttpContext;
httpContext.Request.EnableBuffering();
var routeData = httpContext.GetRouteData();
var actionContext = new ActionContext(httpContext, routeData, controllerActionDescriptor);

我看到routeData包含正确的值,但是actionContext.ModelState为空。为什么会这样?

0 个答案:

没有答案