6

我已经从 AuthorizeAttribute 实现 RoleAuthorize 类

public sealed class RoleAuthorize : AuthorizeAttribute
{
    protected override bool AuthorizeCore(HttpContextBase httpContext)
    {
        var roles = Roles;

        return false;
    }
}

但是当过滤器发生时,属性 Roles 为空。谢谢。

4

1 回答 1

-3

您是否像这样在操作方法中应用了过滤器?

[RoleAuthorize(Roles = "MyRole")]
public ActionResult MyAction()
{
         return View();
}
于 2013-07-14T13:53:31.847 回答