Is it possible to skip the whole action method execution and return a specific ActionResult
when a certain condition is met in OnActionExecuting
?
You can use filterContext.Result for this. It should look like this:
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
//Check your condition here
if (true)
{
//Create your result
filterContext.Result = new EmptyResult();
}
else
base.OnActionExecuting(filterContext);
}