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

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
主站蜘蛛池模板: 寻乌县| 灵山县| 厦门市| 宜君县| 卓尼县| 内丘县| 平陆县| 金沙县| 呼玛县| 驻马店市| 张家口市| 图木舒克市| 雅安市| 辰溪县| 安岳县| 铅山县| 疏勒县| 南漳县| 琼结县| 广宗县| 寿宁县| 隆尧县| 平利县| 修武县| 宣武区| 日照市| 南城县| 天门市| 玛沁县| 祁阳县| 确山县| 比如县| 卢龙县| 金湖县| 依安县| 临颍县| 颍上县| 岱山县| 会东县| 大庆市| 苗栗市|