Basically in my RouteConfig.cs I am trying to map a route that varies depending on the current browser language.
What I'm trying to get to is a dynamic path like:
/books-with-description/
/libros-con-descripcion/
these strings are constant (they are not stored in db) and they are only two (Spanish and English)
Try with:
routes.MapRoute(
name: "Libros",
url: "{index}/index/{lang}",
defaults: new { controller = "Libros", action = "Get", lang = UrlParameter.Optional, index = @Rurl.LibrosConDescripcion }
);
And I also tried:
routes.MapRoute(
name: "Libros",
url: @Rurl.LibrosConDescripcion + "/index/{lang}",
defaults: new { controller = "Libros", action = "Get", lang = UrlParameter.Optional}
);
Being @ Rurl.LibrosConDescripcion the access to the string in the resource file
For some reason in this case I'm not taking the language change that I set in CurrentThread.CurrentCulture. I guess it's because the application starts running in its own Thread and starts only once, regardless of the Threads created by each request from the client's browser (Correct me if I'm wrong).
Suggestions? Do not I have another option to generate that part of the URL from an ActionLink in Razor?
(The idea was to set it only once and not have to do it for every view that wants to access this url)