Saeed Neamati
Saeed Neamati

Reputation: 35822

How to make ASP.NET MVC create lowercase urls (action links)?

I know this question has been asked many times. But people suggest creating custom derived route classes, or writing lowercase everywhere in code (for action links) which is a really dirty way (what if I just decide to make'em all Pascal Cased again? changing hundreds of links?), or they suggest to create HTML helpers to do that (which is not a bad answer). But isn't there a more simple way? I mean something like setting some configuration in web.config file, or using an HttpModule or something else which is both simple, and centralized?

Upvotes: 1

Views: 693

Answers (2)

David McLean
David McLean

Reputation: 1497

The following will allow that.. http://mvccoderouting.codeplex.com/ - and much more besides.

Upvotes: 0

Kinexus
Kinexus

Reputation: 12904

Apart from the options you have already listed, I can think of no other way of producing this result.

In short, the URL needs to be processed by 'something', be it .ToLower(), a Helper Method or HTTPModule.

In most of our applications, we use a Global Static method that performs actions on the desired URI and returns the result.

Upvotes: 1

Related Questions