I searched on the Internet the same question with no luck, so I just tried it myself and it works:
public class MySweetAttribute: ActionFilterAttribute { public bool Disable { get; set; } public override void OnActionExecuting(ActionExecutingContext filterContext) { if (Disable) return; ... } }
Then, if you want to disable the global filter, just add the attribute to the action with the propierty parameter disabled to true:
[MySweetAttribute(Disable=true)] public ActionResult Index() { return View(); }
Hope for this help
eledu81 Apr 08 2018-11-11T00: 00Z
source share