ASP.NET MVC 3 Case Sensitive URLs

十年热恋 提交于 2019-12-06 13:49:35

I haven't tried it, but I would think that if you use a regular expression route constraint that only matched the uppercase and lowercase seperate, that would work. I don't think it's a good idea though.

That seems like a bad idea. You're assuming that folks will never touch a url by hand, always clicking links.

Plus, by default, MSSQL is case insensitive, assuming that some of your route values are database bound.

I'd also be willing to bet that all urls in the search engines are lower case( Edumacated guess ).

EDIT

All google paid search urls are lower case.

If you STILL insist on doing this:

You also may have to have implement a custom viewengine that looks for the views on a case sensitive basis. Also a custom controller factory to find controllers that are case sensitive.

Also note that regex options like case sensitivity can be changed mid regex by things like:

...(?-i:nonCaseSensitiveBit)backToCaseInsensitive...

See the Regex docs for the full readout.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!