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

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
主站蜘蛛池模板: 天全县| 巴南区| 寿阳县| 拜泉县| 濮阳市| 宾川县| 蒙城县| 石阡县| 三台县| 吉林省| 阳江市| 南平市| 廉江市| 罗甸县| 濮阳市| 从江县| 咸宁市| 鞍山市| 莱西市| 慈溪市| 饶河县| 五河县| 监利县| 贵定县| 长垣县| 清流县| 通化市| 日照市| 河南省| 大竹县| 淮安市| 贺州市| 房山区| 大悟县| 屏边| 蒙城县| 万宁市| 金川县| 福安市| 灌云县| 汉川市|