Categories

Middleware

In ASP.NET Core, middleware are C# classes that can handle an HTTP request or response. 

Middleware can either:

  • Handle an incoming HTTP request by generating an HTTP response.
  • Process an incoming HTTP request, modify it, and pass it on to another piece of middleware.
  • Process an outgoing HTTP response, modify it, and pass it on to either another piece of middleware, or the ASP.NET Core web server.

More about it here.

This is example of very simple middleware.

You have to register it, using IGrandStartup interface. To do it, you have to create another file.

 

That's it! You have your own working middleware.

back to top