What is a middleware?

A middleware is a logical component that sits on the path of a request-response pipeline and is invoked for every request to execute a particular responsibility / functionality on that request. It has access to the HttpContext of the current request and so can be able to validate or reject an incoming request for some condition.

In ASP.NET Core, all the components of the framework such as controllers, authorizers and loggers are internally executed as middlewares.

Developers can also define and include own logical components to be executed to validate or emphasize on an incoming request by registering these as middlewares.

A middleware is a logical component that sits on the path of a request-response pipeline and is invoked for every request to execute a particular responsibility / functionality on that request. It has access to the HttpContext of the current request and so can be able to validate or reject an incoming request for some condition.

In ASP.NET Core, all the components of the framework such as controllers, authorizers and loggers are internally executed as middlewares.

Developers can also define and include own logical components to be executed to validate or emphasize on an incoming request by registering these as middlewares.

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