• <small id='TNdsR'></small><noframes id='TNdsR'>

      <tfoot id='TNdsR'></tfoot>
      • <bdo id='TNdsR'></bdo><ul id='TNdsR'></ul>
    1. <i id='TNdsR'><tr id='TNdsR'><dt id='TNdsR'><q id='TNdsR'><span id='TNdsR'><b id='TNdsR'><form id='TNdsR'><ins id='TNdsR'></ins><ul id='TNdsR'></ul><sub id='TNdsR'></sub></form><legend id='TNdsR'></legend><bdo id='TNdsR'><pre id='TNdsR'><center id='TNdsR'></center></pre></bdo></b><th id='TNdsR'></th></span></q></dt></tr></i><div id='TNdsR'><tfoot id='TNdsR'></tfoot><dl id='TNdsR'><fieldset id='TNdsR'></fieldset></dl></div>

      <legend id='TNdsR'><style id='TNdsR'><dir id='TNdsR'><q id='TNdsR'></q></dir></style></legend>

        如何在 ASP.NET Core 中强制执行小写路由?

        How do you enforce lowercase routing in ASP.NET Core?(如何在 ASP.NET Core 中强制执行小写路由?)

          • <small id='lviw6'></small><noframes id='lviw6'>

            <i id='lviw6'><tr id='lviw6'><dt id='lviw6'><q id='lviw6'><span id='lviw6'><b id='lviw6'><form id='lviw6'><ins id='lviw6'></ins><ul id='lviw6'></ul><sub id='lviw6'></sub></form><legend id='lviw6'></legend><bdo id='lviw6'><pre id='lviw6'><center id='lviw6'></center></pre></bdo></b><th id='lviw6'></th></span></q></dt></tr></i><div id='lviw6'><tfoot id='lviw6'></tfoot><dl id='lviw6'><fieldset id='lviw6'></fieldset></dl></div>

              <legend id='lviw6'><style id='lviw6'><dir id='lviw6'><q id='lviw6'></q></dir></style></legend>
                <bdo id='lviw6'></bdo><ul id='lviw6'></ul>
              • <tfoot id='lviw6'></tfoot>

                    <tbody id='lviw6'></tbody>
                  本文介绍了如何在 ASP.NET Core 中强制执行小写路由?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 ASP.NET 4 中,这就像应用程序的 RegisterRoutes 处理程序中的 routes.LowercaseUrls = true; 一样简单.

                  In ASP.NET 4 this was as easy as routes.LowercaseUrls = true; in the RegisterRoutes handler for the app.

                  我在 ASP.NET Core 中找不到实现此目的的等效项.我想它会在这里:

                  I cannot find an equivalent in ASP.NET Core for achieving this. I'd think it would be here:

                  app.UseMvc(configureRoutes =>
                  {
                      configureRoutes.MapRoute("Default", "{controller=App}/{action=Index}/{id?}");
                  });
                  

                  configureRoutes 中似乎没有任何内容允许它...除非在某个地方有我在文档中找不到的扩展方法?

                  But nothing in configureRoutes looks to allow it... unless there's an extension method somewhere that I can't find in the docs perhaps?

                  推荐答案

                  对于 ASP.NET Core:

                  For ASP.NET Core:

                  Startup 类的 ConfigureServices 方法中添加以下行之一:

                  Add one of the following lines to the ConfigureServices method of the Startup class:

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

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

                  感谢 Skorunka 作为评论的回答.我认为值得推广为实际答案.

                  Thanks to Skorunka for the answer as a comment. I thought it was worth promoting to an actual answer.

                  这篇关于如何在 ASP.NET Core 中强制执行小写路由?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to keep the Text of a Read only TextBox after PostBack()?(PostBack()之后如何保留只读文本框的文本?)
                  Winforms Textbox - Using Ctrl-Backspace to Delete Whole Word(Winforms 文本框 - 使用 Ctrl-Backspace 删除整个单词)
                  C# - Add button click events using code(C# - 使用代码添加按钮单击事件)
                  Multi-color TextBox C#(多色文本框 C#)
                  How can i set the caret position to a specific index in passwordbox in WPF(如何将插入符号位置设置为 WPF 密码框中的特定索引)
                  C# Numeric Only TextBox Control(C# 纯数字文本框控件)
                    <tbody id='RDPsd'></tbody>
                  <tfoot id='RDPsd'></tfoot>
                    • <i id='RDPsd'><tr id='RDPsd'><dt id='RDPsd'><q id='RDPsd'><span id='RDPsd'><b id='RDPsd'><form id='RDPsd'><ins id='RDPsd'></ins><ul id='RDPsd'></ul><sub id='RDPsd'></sub></form><legend id='RDPsd'></legend><bdo id='RDPsd'><pre id='RDPsd'><center id='RDPsd'></center></pre></bdo></b><th id='RDPsd'></th></span></q></dt></tr></i><div id='RDPsd'><tfoot id='RDPsd'></tfoot><dl id='RDPsd'><fieldset id='RDPsd'></fieldset></dl></div>
                        <bdo id='RDPsd'></bdo><ul id='RDPsd'></ul>

                          <legend id='RDPsd'><style id='RDPsd'><dir id='RDPsd'><q id='RDPsd'></q></dir></style></legend>

                          <small id='RDPsd'></small><noframes id='RDPsd'>