FeaturedIT topics

Demystified: Routing in ASP.Net Core

Routing maps incoming requests to the respective route handlers and generates outgoing URLs. ASP.Net Core is an open source, cross-platform, lean, and modular framework for building high-performance web applications.

Routing in ASP.Net Core is managed by the routing middleware in the Microsoft.AspNetCore.Routing namespace. The middleware handles requests and responses and inspects, routes, and even modifies the request and response messages that flow through the pipeline.

In essence, routing in ASP.Net Core maps the incoming URLs to the respective controller actions and then generates the corresponding outgoing URLs.

Here’s how routing in ASP.Net Core works:

  1. When a new request arrives, the routing middleware parses the incoming URL.
  2. A matching route is searched in the RouteCollection.
  3. If a matching route is found, control is passed to the RouteHandler.
  4. If a matching route is not found, the next middleware is invoked.

Related Articles

Back to top button