- Modern Web Development with ASP.NET Core 3
- Ricardo Peres
- 119字
- 2021-06-18 18:35:57
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.
推薦閱讀
- Visual C++程序設(shè)計(jì)教程
- Android Studio Essentials
- Developing Mobile Web ArcGIS Applications
- Python自動(dòng)化運(yùn)維快速入門
- Java開發(fā)入行真功夫
- C++程序設(shè)計(jì)基礎(chǔ)教程
- Mastering Google App Engine
- Building an RPG with Unity 2018
- Unity 2D Game Development Cookbook
- 新一代SDN:VMware NSX 網(wǎng)絡(luò)原理與實(shí)踐
- 智能搜索和推薦系統(tǒng):原理、算法與應(yīng)用
- C/C++數(shù)據(jù)結(jié)構(gòu)與算法速學(xué)速用大辭典
- 零基礎(chǔ)學(xué)HTML+CSS第2版
- 30天學(xué)通C#項(xiàng)目案例開發(fā)
- SFML Game Development