How to write custom middleware in ASP.NET Core

Опубликовано: 03 Март 2024
на канале: Round The Code
373
23

ASP.NET Core has a number of built-in middleware components that can be added to an application. However, there may be instances where you wish to write your own .NET custom middleware.

We'll show you a number of ways of how you can write your own in a Web API using C# which includes writing to the response of a HTTP request.

We'll also show you the importance of passing to the next middleware component and how not doing that can cause huge problems with your application with unpredictable results.

📖 Learn .NET and C# with our online courses 📖
https://www.roundthecode.com/dotnet-c...

👨‍💻Take our .NET and C# coding challenges👨‍💻
https://www.roundthecode.com/dotnet-c...

► More information:
https://www.roundthecode.com/dotnet-t...

► Chapters
0:00 What we'll cover
0:13 Examples of ASP.NET Core middleware
0:32 Writing custom middleware
1:34 Short-circuiting
2:13 Terminal middleware
2:49 Writing to a response after it has started to be written
3:29 Middleware in it's own class
4:33 Watch our exception handling middleware video

#middleware #dotnet8 #dotnet