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

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.

主站蜘蛛池模板: 进贤县| 奇台县| 广东省| 汾阳市| 东丽区| 仁化县| 宜宾县| 南宫市| 青龙| 六枝特区| 比如县| 古交市| 临海市| 中江县| 兴义市| 德格县| 合山市| 紫云| 建昌县| 建瓯市| 吴堡县| 绵阳市| 建始县| 凤山县| 顺义区| 榆社县| 江陵县| 德江县| 陕西省| 昌乐县| 钟祥市| 望都县| 大田县| 榆树市| 禄劝| 桂东县| 盐源县| 沽源县| 甘泉县| 南投市| 平潭县|