I would like to generate Url without controller name. If I use code below…
@Url.Action("d", null, new { id = Model.DownloadId })
…I get url like this
http://localhost:814/DefaultController/d/11234
I would like to get url like this
http://localhost:814/d/11234
My route code..
routes.MapRoute("Download result form", "d/{id}", new { controller = "Result", action = "DownloadForm" });
… handles url like above(only with Action and Id without Controller name) perfectly.
This would cause you trouble in that these actions would conflict with binding to other controllers.
To make clean urls like what you want it would be more usual to omit the action name, e.g. this page
stackoverflow/questions/{id}UPDATE
provide the Controller in the Action to allow it to know which route to pick, i.e.
If that doesn’t work it is being grabbed by another route, so the ordering of your routes is not as you want them.