views:

18

answers:

1

I have a route:

"{culture}/{controller}/{action}/{id}", new { culture = "en", controller = "Home", action = "Index", id = UrlParameter.Optional }

The Url becomes http://mysite.com

I want to show the culture name so that the url will look like this: http://mysite.com/en

A: 

Defaults are always hidden

Defaults are always hidden as long as all values after it are provided with defaults as well. You will have to provide two route definitions:

"en/{controller}/{action}/{id}", new { culture = "en" , ... }
"{culture}/{controller}/{action}/{id}", ...

The first one will always append en at the end for the outbound links and will aslo process the request when an inbound request will start with en.

In case culture is different, the second route will get hit. In case of inbound and outbound processing.

Robert Koritnik