路由未按照我对 MVC4 路由的期望执行 ASP.NET



我有两条非常简单的路线。 一个工作并将第一个参数(年份)传递到控制器,另一个将参数作为"文本"发送。 我只是不明白。

以下是我定义的两条路线。 它们在形状上似乎与我一模一样。

控制器只是..

         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
                  });

我在这里遇到了导致问题的其他问题。

最新更新