I am using multiple AuthorizeAttribute on my methods and it's giving me compilation error. This error comes only on build machine and somehow doesn't come on my local machine.
Rosyln Error CS0579: Duplicate 'AuthorizeAttribute' attribute
From below SO post, it seems okay to use multiple authorize attribute. I tried adding this on my custom authorize attribute -> [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] but it doesn't seem to work.
Multiple Authorization attributes on method
Is it possible to use multiple authorizeAttribute? If yes, what am I missing?
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
public class MyCustomAuthorizeAttribute : AuthorizeAttribute
{
}
[MyCustomAuthorizeAttribute (permissions : new[]{"Permission1", "Permission2"})]
[MyCustomAuthorizeAttribute (permissions : new[]:{"Permission3", "Permission4"})]
public string GetSomething(string someId)
{
}