Lowercase URLs without affecting parameters

前端 未结 1 548
南方客
南方客 2021-02-13 15:14

I\'m currently using ASP.NET MVC 4 Routing with the LowercaseUrls option set to true and it\'s working great. I\'m using this configuration:

         


        
1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-13 15:33

    I've run into this before. What I ended up doing was getting AttributeRouting.

    They have a sweet feature (linked above) to PreserveCaseForUrlParameters.

    The other option is to use LowercaseRoutesMVC. In this scenario you would make certain routes lowercase and the ones you want to leave alone you can just use routes.MapRoute beforehand. However, this can get messy since the specially configured ones will be lowercase where the entire route of the default ones wouldn't be.

    Hope this helps!

    0 讨论(0)
提交回复
热议问题