Gerwald
Gerwald

Reputation: 1589

Howto dynamically localize the full URL (including Controller, Action and other parameters) in ASP.NET MVC 3

I am looking for a solution to dynamic configure the routing in ASP.NET MVC 3, based on the current language the user is using on the website.

now i have:

domain.com/de/controller/action/subaction/XX
domain.com/en/controller/action/subaction/XX

and i would like to have:

domain.com/de/bereich/aktion/unteraktion/XX
domain.com/en/controller/action/subaction/XX

the name for the controller/action & subaction should be configurable through the Database (the german names as well as the english ones)

As the default route configuration works well in ASP.NET MVC, i would prefer to use it, and e.g. just customize the class that handles the mapping between the URL and the controller (etc).

Upvotes: 1

Views: 1108

Answers (1)

QQping
QQping

Reputation: 1370

http://blog.maartenballiauw.be/post/2010/01/26/Translating-routes-%28ASPNET-MVC-and-Webforms%29.aspx this article will help you exactly with your problem but please think about it twice.

Upvotes: 3

Related Questions