我有两条非常简单的路线。一个工作并将第一个参数(年份)传递给控制器,另一个将参数作为“文本”发送。我只是不明白。
以下是我定义的两条路线。它们的形状和我一模一样。
控制器只是..
public ActionResult Index(string year)...
// SESSIONS
routes.MapRoute("SessionRouteAll", "Session/{year}",
new
{
/* Your default route */
controller = "Session",
action = "Index",
year = currentYear
});
// SPEAKERS
routes.MapRoute("SpeakerRouteAll", "Speaker/{year}",
new
{
/* Your default route */
controller = "Speaker",
action = "Index",
year = currentYear
});