Home > front end >  Middleware Invoke called only on Request (but not on Response)
Middleware Invoke called only on Request (but not on Response)

Time:09-06

I have a controller action that when called from client goes through the JwtMiddleware Invoke method. But when I return from the action using BaseController Ok method method Invoke is not called. Is that correct behaviour?

CodePudding user response:

Yes. As described in the enter image description here

public class SampleActionFilter : IActionFilter
{
    public void OnActionExecuting(ActionExecutingContext context)
    {
        // Do something before the action executes.
    }

    public void OnActionExecuted(ActionExecutedContext context)
    {
        // Do something after the action executes.
    }
}
  • Related