0

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
asked Jan 2, 2015 at 11:05

2 Answers 2

1

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
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.