I’m looking for some information on Routing in MVC with C#. I’m currently very aware of the basics of routing in MVC, but what i’m looking for is somewhat difficult to find.
Effectively, what I want to find is a way of defining a single route that takes a single parameter.
The common examples I have found online is all based around the example
routes.MapRoute( 'Default', '{controller}.mvc/{action}/{id}' new { controller = 'Default', action='Index', id=''});
By mapping this route, you can map to any action in any controller, but if you want to pass anything into the action, the method parameter must be called ‘id’. I want to find a way around this if it’s possible, so that I don’t have to constantly specify routes just to use a different parameter name in my actions.
Has anyone any ideas, or found a way around this?
You can construct the routes as you like
Also, look at this post, it contains all kind of samples in the comments section