I have spent several hours today reading up on doing Custom Routing in ASP.NET MVC. I can understand how to do any type of custom route if it expands from or is similar/smaller than the Default Route. However, I am trying figure out how to do a route similar to:
/Language/{LanguageID}/Question/{QuestionID}/
And what I would like, too, is similar to how SO works. Something like开发者_高级运维:
/Language/{LanguageID}/Arabic/Question/{QuestionID}/Some-Question-Title
Where "Arabic" and "Some-Question-Title" can be almost anything because what really matters is the ID's
A complete url example might be
http://example.com/Language/22/Arabic/Question/135/What-is-the-importance-of-grammar
Am I going beyond what can be done with the extended URL past the language ID?
You can pretty much do anything with routes, but the key is knowing in which order to register them. When MVC selects a route, it does so in order in which they were registered, and the first route that matches, is the one that is selected.
精彩评论