官术网_书友最值得收藏!

Routing

This chapter talks about routing, that is, the process by which ASP.NET Core translates a user request into an MVC controller and action. This can be a complex process because subtle changes in a request can lead to different endpoints (controller/action pairs) being called. Several aspects need to be taken into account: the protocol (HTTP or HTTPS), whether the user issuing the request is authenticated or not, the HTTP verbs, the path of the request, the query string, and the actual types of the path and query string parameter values.

Routing also defines what happens when a route is not matched, that is, the catch-all route, and it can be used for complex situations where we need to define custom route constraints.

ASP.NET Core offers different ways by which we can configure routing, which can be divided into convention-based and explicit configuration.

By the end of this chapter, you will be able to define routing tables and apply routing configuration in all of the different ways made available by ASP.NET Core for MVC applications.

The objectives of this chapter are listed here:

  • Understanding endpoint routing
  • Configuring routing
  • Understanding routing tables
  • Using route templates
  • Matching route parameters
  • Using dynamic routing
  • Learning route selection through attributes
  • Forcing host selection from attributes
  • Setting route defaults
  • Routing to inline handlers
  • Applying route constraints
  • Using route data tokens
  • Routing to areas
  • Using attributes for routing
  • Using routes for error handling
主站蜘蛛池模板: 沙坪坝区| 铜山县| 赫章县| 克拉玛依市| 白河县| 湖南省| 灌云县| 木里| 翁牛特旗| 元氏县| 定日县| 全椒县| 宣城市| 葫芦岛市| 巴彦县| 双流县| 荃湾区| 洮南市| 巴林右旗| 南澳县| 周口市| 博罗县| 桐乡市| 宁强县| 健康| 屯昌县| 鄂伦春自治旗| 木兰县| 仁布县| 孝义市| 永新县| 开鲁县| 江油市| 临沂市| 辽源市| 菏泽市| 阿巴嘎旗| 南郑县| 墨玉县| 锡林浩特市| 紫金县|