Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Routing .NET核心RC2中的小写URL_Routing_Asp.net Core_Asp.net Core Mvc - Fatal编程技术网

Routing .NET核心RC2中的小写URL

Routing .NET核心RC2中的小写URL,routing,asp.net-core,asp.net-core-mvc,Routing,Asp.net Core,Asp.net Core Mvc,在.net 5/MVC 6 RC1中,我们可以通过以下方式强制路由中使用小写URL: services.ConfigureRouting(options => { options.LowercaseUrls = true; }); services.Configure<RouteOptions>(options => options.LowercaseUrls = true); 这是如何在RC2/.net core 1.0中实现的?我认为您现在正在寻找扩展方法

在.net 5/MVC 6 RC1中,我们可以通过以下方式强制路由中使用小写URL:

services.ConfigureRouting(options =>
{
    options.LowercaseUrls = true;
});
services.Configure<RouteOptions>(options => options.LowercaseUrls = true);

这是如何在RC2/.net core 1.0中实现的?

我认为您现在正在寻找扩展方法。作为服务添加的一部分,“配置”路由选项的实例:

services.AddRouting(options => options.LowercaseUrls = true);
更新

您也可以调用以下命令:

services.ConfigureRouting(options =>
{
    options.LowercaseUrls = true;
});
services.Configure<RouteOptions>(options => options.LowercaseUrls = true);
services.Configure(options=>options.LowercaseUrls=true);

我在我的博客文章中详细介绍了一些API更改。

有趣的是,您可以调用服务。Configure options=>{options.LowercaseUrls=true;});似乎不适用于登录重定向url,但在RC1中也是如此。我在研究使所有url都小写的要求时遇到了此设置。我只是看不出有什么不同(.netcore1.1webapi,在IIS背后大摇大摆)。它仍然接受INSTIVIE URL中的大小写。有没有提示应该更改什么以及如何测试它?