Custom AuthorizeAttribute Roles属性为空
本文关键字:属性 Roles AuthorizeAttribute Custom | 更新日期: 2023-09-27 18:22:12
我已经从AuthorizeAttribute 实现了RoleAuthorize类
public sealed class RoleAuthorize : AuthorizeAttribute
{
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
var roles = Roles;
return false;
}
}
但当筛选器发生时,属性Roles为null。谢谢
您在操作方法中应用了过滤器吗?
[RoleAuthorize(Roles = "MyRole")]
public ActionResult MyAction()
{
return View();
}