I have the routes.
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute("SurveySubmitRoute", "Survey/Submit",
defaults: new {action = "Submit", controller = "Survey"});
routes.MapRoute("SurveyWelcomeRoute", "Survey/{id}",
defaults: new { action = "Index", controller = "Survey" });
routes.MapRoute("SurveyLanguageRoute","Survey/Language{languageName}",
defaults: new { action = "Language", controller = "Survey" });
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Account", action = "Login", id = UrlParameter.Optional }
);
}
In my view, I want to go to the Language method.
window.location.href = "/Survey/Language?languageName=" + selectedValue;
In the controller, we have
public ActionResult Index(Guid id){
And
public ActionResult Language(string languageName)
{
}
My question is the code doesn't go to Language method. It always goes to Index method.
Why?
What I have tried:
No clue so far. Thanks for help.