I would like to respond via a JsonResult
from a piece of Asp.Net Core middleware but it's not obvious how to accomplish that. I have googled around alot but with little success. I can respond via a JsonResult
from a global IActionFilter
by setting the ActionExecutedContext.Result
to the JsonResult
and that's cool. But in this case I want to effectively return a JsonResult
from my middleware. How can that be accomplished?
I framed the question with regard to the JsonResult
IActionResult
but ideally the solution would work for using any IActionResult
to write the response from the middleware.