I have an MVC app running ServiceStack, I also have added a pre-request filter in appHost.PreRequestFilters
, and all is good when I make an API call on a route like /api/something
, from PostMan, the pre request filter is run just fine. (it does some CSRF checks).
Now, I add an addtional MVC POST action on route /somethingelse
, and in there I do some minimal processing, where I want to call my ServiceStack service (the one at /api/something
).
As recommended, I am using the Gateway of my controller to forward the call to my API, and it does forward the call to my ServiceStack service, but, in this case the PreRequestFilter are bypassed!
[Microsoft.AspNetCore.Mvc.Route("/somethingelse")]
public IActionResult DoSomethingElse(string stuff)
{
try
{
// This next call bypasses my PreRequestFilters
Gateway.Send(new DoSomethingRequest
{
Stuff = stuff,
});
}
catch (Exception ex)
{
return Problem(ex.Message, null, ex.ToStatusCode());
}
return Redirect("/");
}
Can you advise how to make this Gateway call trigger the PreRequestFilters? or is not the right pattern to use?