Hands-On Full:Stack Web Development with ASP.NET Core
上QQ阅读APP看书,第一时间看更新

Routing

Routing in ASP.NET Core is the process of mapping incoming requests to application logic that resides in controllers and methods.

ASP.NET Core maps the incoming request based on the routes that you configure in your application, and for each route, you can set specific configurations, such as default values, message handlers, constraints, and so on. 

There are a few ways of controlling the routing in an ASP.NET Core application, but in this chapter, we will concentrate on the two most common ways:

  • Conventional routing: The route is determined based on conventions that are defined in route templates that, at runtime, will map requests to controllers and actions (methods).
  • Attribute-based routing: The route is determined based on attributes that you set on your controllers and methods. These will define the mapping to the controller's actions.