I need to check if an action have specific attribute, and I need do it in the following method :
protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext) {
}
I know I can Check it here:
public override void OnAuthorization(AuthorizationContext filterContext) {
filterContext.ActionDescriptor.IsDefined(typeof(AnonymousAllowedAttribute), true)
...
}
Does any one know how can I Get ActionDescriptor with System.Web.HttpContextBase object?
UPDATE
Actually I want if any of actions marked with AnonymousAllowedAttribute the AuthorizeCore method return true or if possible don’t run (I mean my override method).
To do what you want you need to write and register new FilterProvider in your global.asax.
Example:
global.asax:
Now if any of your action is not marked
[AnonymousAllowed]application think that it is marked as[Authorize]PS: Don’t forget to mark
[AnonymousAllowed]your log on and register actions 🙂