ASP.NET MVC参数中的小写路由

时间:2017-11-28 20:59:04

标签: asp.net-mvc routing asp.net-mvc-routing

我有以下代码:

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.LowercaseUrls = true;

    routes.MapRoute(
        name: "CompanyDefault",
        url:  "Company",
        defaults: new { controller = "Company", action = "Index" }
    );
    routes.MapRoute( 
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );

我这样写的时候工作正常:

@Url.Action("ApplicationDriverForm", "ApplicationDriver")

但是当我尝试使用参数:

@Url.Action("ApplicationDriverForm", "ApplicationDriver", new { PaRaMeTeRwithUppercaseLetters = "BlaBlaBla" })

然后在这种情况下,它会在参数名称和参数值

中生成带大写字母的url

如何让它在参数中生成小写字母?

0 个答案:

没有答案