Wie füge ich AuthorizeAttribute auf globaler Ebene hinzu und schließe es für einige Aktionen aus?
Ich muss überprüfen, ob eine Aktion ein bestimmtes Attribut hat, und das muss ich in der folgenden Methode tun:
protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext) {
}
Ich weiß, ich kann es hier überprüfen:
public override void OnAuthorization(AuthorizationContext filterContext) {
filterContext.ActionDescriptor.IsDefined(typeof(AnonymousAllowedAttribute), true)
...
}
Weiß jemand, wie ich bekommen kannActionDescriptor
mitSystem.Web.HttpContextBase
Objekt?
AKTUALISIEREN
Eigentlich möchte ich, wenn eine der Aktionen mit gekennzeichnet istAnonymousAllowedAttribute
dasAuthorizeCore
method return true oder wenn möglich nicht ausführen (ich meine meine override-Methode).