I would like my URLs to use the convention:
/{controller}/{id}/{action}
but not
/{controller}/{action}/{id}
I tried to configure the route as follows:
routes.MapRoute(
"Campaign",
"{controller}/{action}/{id}",
new { controller = "Campaign", action = "Index", id = UrlParameter.Optional }
);
But this does not work, because I cannot make the id parameter optional.
The following URLs work :
/campaign/1234/dashboard
/campaign/1234/edit
/campaign/1234/delete
But these URLs are not :
/campaign/create
/campaign/indexempty
MVC just calls Indexfor both. What am I doing wrong?
source
share