【问题标题】:Routing Not Doing What I expect with MVC4 Routes in ASP.NET路由不符合我对 ASP.NET 中 MVC4 路由的期望
【发布时间】:2013-01-24 07:09:55
【问题描述】:

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

以下是我定义的两条路线。它们的形状和我一模一样。

控制器只是..

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

【问题讨论】:

    标签: asp.net-mvc-4 asp.net-mvc-routing


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2015-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-20
      • 1970-01-01
      • 2013-03-13
      • 1970-01-01
      相关资源
      最近更新 更多