.NET 路由包含区分大小写?
.NET Routing contain case sensitive?
我在 .NET Core 中使用路由,我注意到当我使用相同的路由但用小写字母传递它时,我可以访问相同的页面。
示例:
我的域名。com/Account/Login
我的域名。com/account/login
为什么这里不区分大小写?而且我没有使用 services.AddRouting (options => options.LowercaseUrls = true);
来允许这样做。
我只是想知道字母区分是如何工作的以及为什么它会继续工作。
引自Doc :
Text matching is case-insensitive and based on the decoded representation of the URL's path.
而services.AddRouting (options => options.LowercaseUrls = true);
只是用来将路由模板转为小写。但是您仍然可以使用大写 Url.
访问它
我在 .NET Core 中使用路由,我注意到当我使用相同的路由但用小写字母传递它时,我可以访问相同的页面。
示例: 我的域名。com/Account/Login 我的域名。com/account/login
为什么这里不区分大小写?而且我没有使用 services.AddRouting (options => options.LowercaseUrls = true);
来允许这样做。
我只是想知道字母区分是如何工作的以及为什么它会继续工作。
引自Doc :
Text matching is case-insensitive and based on the decoded representation of the URL's path.
而services.AddRouting (options => options.LowercaseUrls = true);
只是用来将路由模板转为小写。但是您仍然可以使用大写 Url.