Define route this way? Can anyone tell me how it will be used if i have to lang option on
routes.MapRoute(
name: "Default",
url: "{lang}/{controller}/{action}/{id}",
defaults: new { lang = UrlParameter.Optional, controller = "Home", action = "Index", identifier = UrlParameter.Optional }
);
tereško
58.5k26 gold badges101 silver badges152 bronze badges
2 Answers 2
MVC will strictly pattern-match, whether you said that the lang-Parameter is optional or not:
a/b/c/d
=> lang = a, controller = b, action = c, id = d.
a/b/c
=> lang = a, controller = b, action = c, id = null (because the default value says this is optional)
a/b
=> lang = a, controller = b, action = Index (because of the default value), id = null
etc.
answered Jan 2, 2015 at 11:10
Manuel Schweigert
4,9844 gold badges22 silver badges32 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
It depends on what are you use
For routing you can use: Sammy.Js + Knockout
Or Angular - Angular had nice routing
answered Jan 2, 2015 at 20:31
David Abaev
6965 silver badges22 bronze badges
Comments
default