After reading about asp.net core middlware, I am confused when should I use filters and when should I use middlewares as they seem to achieve the same goal. When should midd
There is a video about this on channel 9: ASP.NET Monsters #91: Middleware vs. Filters. To summarize the video:
The execution of request starts and we have a middleware, and another middleware, think of it like the "Russian dolls inside of dolls" and eventually the routing middleware kicks in and then request goes into the MVC pipline.
So if you don't require the context of MVC (let's say you're concerned about flow and execution, like responding to headers some pre-routing mechanism, etc.) then use middlewares.
But if you require the context of MVC and you want to operate against actions then use filters.