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

Route configuration

There are a few options we can configure for route generation, all of which are configured through the AddRouting extension method over the services definition:

services.AddRouting(options =>
{
options.LowercaseUrls = true;
options.AppendTrailingSlash = true;
options.ConstraintMap.Add("evenint", typeof(EvenIntRouteConstraint));
});

The RouteOptions class supports the following properties:

  • AppendTrailingSlash: Determines whether or not a trailing slash (/) should be appended to all generated URLs; the default is false (meaning it shouldn't)
  • LowercaseUrls: Determines whether or not the generated URLs should be lowercase; the default is false
  • ConstraintMap: Determines where constraints are mapped; more on this when we talk about route constraints

But route configuration does not end here—the next section is actually the most important one: Creating routing tables.

主站蜘蛛池模板: 崇义县| 商洛市| 奉节县| 炉霍县| 江西省| 沈阳市| 凤山县| 通榆县| 五华县| 石泉县| 军事| 延津县| 绥中县| 建水县| 仙居县| 济源市| 碌曲县| 台东市| 辽宁省| 任丘市| 阿拉善右旗| 晋宁县| 吕梁市| 昌都县| 惠来县| 什邡市| 道孚县| 邵武市| 崇义县| 伽师县| 蓬安县| 平泉县| 固始县| 青龙| 海阳市| 固安县| 修文县| 定州市| 阿拉善左旗| 寿宁县| 水富县|