iinuwa
❔ Middleware in ASP.NET MVC (not Core)
I have some old applications on ASP.NET MVC 5 and 6, and I want to accomplish something like the automatic TraceId propagation that ASP.NET Core does. (E.g., reading
traceparent
from the incoming request and setting the Activity.Current
property accordingly.)
I would like to have some middleware that runs before every controller and sets the Activity. To create this middleware, do I need to use OWIN? Or is there something built into ASP.NET MVC that I can use to run code to read the request before it is handed over to the controller methods?2 replies