954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Dynamic locale for asp.net routing

I have page with a link like

www.domain.com/Login.aspx


and I would like to make this url look like

www.domain.com/en/login
www.domain.com/fr/login


depending on the current language.

I made new route like

routes.MapPageRoute(
         "Login",       // Route name
         "{locale}/login",       // Route URL
         "~/Login.aspx"   // Web page to handle route
     );


but how I can give a value to {locale} from C#, depending on the current language.

NavigateUrl='<%# Page.GetRouteUrl("Login", new { locale = Eval("locale").ToString() }) %>'


P.S. I use ASP.NET 4.0 Webforms.

batoo
Newbie Poster
1 post since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

I think u can do that by placing the page with foreign language in a directory named 'en' and the application will just figure it out- its just a suggestion u can try it.

Sarama2030
Junior Poster in Training
74 posts since May 2009
Reputation Points: 10
Solved Threads: 4
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: