I suggest making a url in this format:
http:
Then you can do these simple steps:
<%= Html.ActionLink("Francais", "Home", "MyController", new { id = "fr" }), null %> <%= Html.ActionLink("English", "Home", "MyController", new { id = "en" }), null %>
Then in your controller there is an action:
public ActionResult Home(string id) { if(id == "en"){ // do something } else if(id == "fr") { // do something else } return View(); }
Route Global.asax
routes.MapRoute( "HomeLanguageRoute", // Route name "MyController/Home/{id}", // URL with parameters new { controller = "MyController", action = "Home", id = "" } // Parameter defaults );
source share