I have this route:
routes.MapRoute(null, "Users/{id}/Summary", new { controller = "Users", action = "GetSummary" });
How can I specify this using a Url.Action?
I'm currently using:
string path = Url.Action("Index", "Users", new { id = user.Id } ) + "/Summary";
Is there a cleaner approach?
Why are you using Index
when the action is GetSummary
?
string path = Url.Action("GetSummary", "Users", new { id = user.Id } );
You probably want to give your Route a name
routes.MapRoute("GetSummary", "Users/{id}/Summary",
new
{
controller = "Users",
action = "GetSummary"
});