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
Middleware operate on the level of ASP.NET Core and can act on every single request that comes in to the application.
MVC filters on the other hand only run for requests that come to MVC.
So for example, if I wanted to enforce that all requests must be done over HTTPS, I would have to use a middleware for that. If I made an MVC filter that did that, users could still request e.g. static files over HTTP.
But then on the other hand something that logs request durations in MVC controllers could absolutely be an action filter.