开发者

Possible to have multiple FilterAttributes?

开发者 https://www.devze.com 2023-02-01 18:15 出处:网络
Is it possible to stack multiple filter attributes? For instance I have this attribute which checks if a person has permission to \"Administrator\" OR \"Queue\"

Is it possible to stack multiple filter attributes? For instance I have this attribute which checks if a person has permission to "Administrator" OR "Queue"

    [ClientPortalSecured("Administrator", "Queue")]
    public ActionResult Index()
    {
        return View(this.GetModel());
    }

but what if I wanted to check for these AND something else? Is it possible to do something like this?

    [ClientPortalSecured("Administrator", "Queue")]
    [ClientPortalSecured("abc")]
    public ActionResult Index()
 开发者_如何学JAVA   {
        return View(this.GetModel());
    }

I currently get "Duplicate 'ClientPortalSecured' attribute" compiler error when I try this.


found it. Added

[AttributeUsageAttribute(AttributeTargets.All, AllowMultiple = true)]

to my ClientPortalSecuredAttribute class

0

精彩评论

暂无评论...
验证码 换一张
取 消