Reputation: 2852
I'm trying to create a route that looks like this
site.com/controller/{Param1}/{dbID}-{friendly-name}
and omit the default action index , and for the action edit to be at the end of the url like so
site.com/controller/{Param1}/{dbID}-{friendly-name}/edit
routes are a bit confusing for me , so any help is appreciated , Thanks!
Upvotes: 0
Views: 61
Reputation: 1039438
You could try like this:
routes.MapRoute(
"SomeRoute",
"{controller}/{param1}/{dbID}-{friendlyName}/{action}",
new
{
controller = "home",
action = "index",
param1 = "CANNOT BE OPTIONAL",
dbID = "SOME DEFAULT ID",
friendlyName = "SOME DEFAULT FRIENDLY NAME"
}
);
Upvotes: 1