What is the difference between a Middleware and a HttpModule?

  • A HttpModule is core to the ASP.NET MVC framework, while a Middleware is native to the ASP.NET Core
  • Both Middleware and HttpModule are pieces of code blocks which lets two or more components interact together during a request execution.
  • HttpModules are registered in the web.config file of the ASP.NET framework while a Middleware is registered via code inside an ASP.NET Core application.
  • The order of execution of HttpModules can't be changed, while since the middlewares are wired programmatically within the code, their order or execution can be altered or skipped when needed.
  • A HttpModule is core to the ASP.NET MVC framework, while a Middleware is native to the ASP.NET Core
  • Both Middleware and HttpModule are pieces of code blocks which lets two or more components interact together during a request execution.
  • HttpModules are registered in the web.config file of the ASP.NET framework while a Middleware is registered via code inside an ASP.NET Core application.
  • The order of execution of HttpModules can’t be changed, while since the middlewares are wired programmatically within the code, their order or execution can be altered or skipped when needed.
Default image
Sriram Mannava

I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity.

Leave a Reply