Why is OnAuthorization
called twice for my straight forward AuthorizationFilterAttribute
?
public class ApiAuthenticateAttribute : AuthorizationFilterAttribute
{
public void override OnAuthorization(System.Web.Http.Controllers.HttpActionContext actionContext)
{
if(NotAuthorized())
throw new Exception();
}
}
The problem was with Ninject.Web.WebApi. For some reason it was registering the filter twice. Updating the package to latest (v 3.2.1) fixed the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With