문제

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()
    {
        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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top