0

Is there any 'catch all' point in Asp.NET Core pipeline (MVC) that would enable us inspecting and modifying the response before serialization (formatting) kicks in?

In some cases, we would like to mask data returned from services and ideally implemented this in a generic way for all controllers, rather than having to write the same code controller by controller.

I cannot see any extension point where we could inspect and modify the response (ActionResult) from the controllers before the response is serialized (formatted) using the desired formatting.

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
user1275154
  • 1,120
  • 1
  • 12
  • 24
  • 2
    Look [here](https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-2.1#result-filters). Essentially, you want an ActionFilter – Camilo Terevinto Jul 27 '18 at 15:06
  • 1
    have you considered to use global Filters? [Here is and exemple](https://stackoverflow.com/questions/9521040/how-to-add-global-asp-net-web-api-filters) – Or Yaacov Jul 27 '18 at 15:12
  • Thank you, completely forgot about those, does the job – user1275154 Jul 30 '18 at 19:40

0 Answers0