Я думаю, вам, возможно, придется использовать отдельные маршруты:
routes.MapRoute("Monitor",
"myaccount/monitor", // Matches
new { controller = "MyAccount", action = "Monitor" }
);
routes.MapRoute("MonitorHistory",
"myaccount/monitor/history", // Matches
new { controller = "MyAccount", action = "Monitor", category = "history" }
);
routes.MapRoute("MonitorOverview",
"myaccount/monitor/overview", // Matches
new { controller = "MyAccount", action = "Monitor", category = "overview" }
);
routes.MapRoute("MonitorProjection",
"myaccount/monitor/projection", // Matches
new { controller = "MyAccount", action = "Monitor", category = "projection" }
);
Альтернативно , вы можете захотеть сделать что-то вроде:
routes.MapRoute("MonitorGlobal",
"myaccount/monitor/{category}", // Matches
new { controller = "MyAccount", action = "Monitor", category = string.Empty }
);
А потом в вашем контроллере:
public ActionResult Monitor(string category)
{
switch (category)
{
case string.Empty:
// do something
break;
case "overview":
// do something
break;
// so on and so forth
default:
// no match, handle accordingly
break;
}
}