Adnan Maqbool Khan’s Post

View profile for Adnan Maqbool Khan, graphic

Team Leader | .NET | Microservices | Azure | Vue | React | Angular | Typescript | RabbitMQ | SQL | MSTest | Cypress

𝐑𝐮𝐧, 𝐔𝐬𝐞, 𝐚𝐧𝐝 𝐌𝐚𝐩 𝐌𝐞𝐭𝐡𝐨𝐝𝐬 𝐢𝐧 .𝐍𝐄𝐓 𝐏𝐢𝐩𝐞𝐥𝐢𝐧𝐞 💡 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 𝐟𝐨𝐫 𝐦𝐨𝐫𝐞 𝐬𝐮𝐜𝐡 𝐜𝐨𝐧𝐭𝐞𝐧𝐭.

  • text

I have a question: For example, i have controller with method with logic and i have a custom method app.Run(etc...) in middleware. How can i "return" to the controller's method and run its logic's work, after the app.Run(etc...) action?

SUBASHREE KRISHNAN

Full stack Developer | Angular | .Net Core | Web API | MVC | Azure

3mo

In the use method the "do something after the middle ware is invoked" the code written here when does it get called ? It might not be called immediately after the invoke of next middle ware as the next middleware might call another .

Muhammad Idrees

Front-End Software Engineer | React.js | Next.js | Javascript | Typescript | 3+ Years

3mo

thanks for sharing

Nikola Knežević

Daily Insights, Features, and fresh knowledge about .NET, Software Engineering, and Software Architectures

3mo

Thanks for sharing Adnan Maqbool.

Mayank Ahuja

Follow for Your Daily Dose of Coding, Software Development & System Design Tips | Tech Book Buff | Exploring AI | Everything I write reflects my personal thoughts and has nothing to do with my employer. 👍

3mo

Good to know, Adnan.

Useful, Thanks Adnan

Ahmed Yezdane

Back-End Developer | ASP.NET Core | Back end Developer Dotnet | .Net Enthusiastic | Software Engineer .Net

3mo

Short and sweet explaination Adnan ✌️

Sina Riyahi

Software Developer | Software Architect | SQL Server Developer | .Net Developer | .Net MAUI | Angular Developer | React Developer

3mo

Thanks for sharing Adnan Maqbool Khan

Carl-Hugo Marcotte

Author of Architecting ASP.NET Core Applications: An Atypical Design Patterns Guide for .NET 8, C# 12, and Beyond | Software Craftsman | Principal Architect | .NET/C# | AI

3mo

Great way to put it. Thanks for sharing Adnan Maqbool Khan

SERKUT YILDIRIM

Microsoft MVP | Helpful Posts About .NET, C# and Visual Studio

3mo

Useful, thanks Adnan

See more comments

To view or add a comment, sign in

Explore topics