𝐑𝐮𝐧, 𝐔𝐬𝐞, 𝐚𝐧𝐝 𝐌𝐚𝐩 𝐌𝐞𝐭𝐡𝐨𝐝𝐬 𝐢𝐧 .𝐍𝐄𝐓 𝐏𝐢𝐩𝐞𝐥𝐢𝐧𝐞 💡 In ASP.NET Core, the Run, Use, and Map extension methods are used to configure middleware in the application pipeline. Here's a breakdown of each method and its purpose: 1- 𝐑𝐮𝐧: The Run method is used to terminate the pipeline and generate a response. It should be used at the end of the middleware pipeline because it stops the pipeline from further processing. 2- 𝐔𝐬𝐞: The Use method is used to add middleware to the pipeline. It can handle requests and pass them to the next middleware in the pipeline using the next parameter. 3- 𝐌𝐚𝐩: The Map method is used to map middleware to specific request paths. It allows you to branch the middleware pipeline based on the request path. 𝐈𝐟 𝐲𝐨𝐮 𝐟𝐢𝐧𝐝 𝐭𝐡𝐢𝐬 𝐮𝐬𝐞𝐟𝐮𝐥, 𝐫𝐞𝐩𝐨𝐬𝐭 ♻️ 𝐚𝐧𝐝 𝐬𝐩𝐫𝐞𝐚𝐝 𝐭𝐡𝐞 𝐤𝐧𝐨𝐰𝐥𝐞𝐝𝐠𝐞. 𝐅𝐨𝐥𝐥𝐨𝐰 🔔 Adnan Maqbool Khan 𝐟𝐨𝐫 𝐦𝐨𝐫𝐞 𝐬𝐮𝐜𝐡 𝐜𝐨𝐧𝐭𝐞𝐧𝐭.
You can also apply filters to the Use method
Insightful
Thanks for sharing Adnan.
Thanks for sharing Adnan.
Good to know, Adnan.
Core methods to manage your pipeline with Middleware, great post Adnan.
Very informative
Nice explaination Adnan 👍🏻
Useful tips
.NET Engineer @Ingsoftware
1moWhat is you preferred way for writing middlewares?