在这里,我想从 in 返回custom action filter而不执行controller action methodin asp.net core WEB API。
以下是我对样品的要求code。
public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
bool valid=SomeMethod();
if(valid)
//executes controller action
else
//returns without executing controller action with the custom message (if possible)
}
我已经搜索并找到了一些相关的问题和答案,但对我没有任何帮助。
找到了这个await base.OnActionExecutionAsync(context, next);,但它跳过了剩余的逻辑filters并直接执行controller action所以不适用于我的场景。