我的网址路由有什么问题?

时间:2013-07-20 08:58:49

标签: asp.net-mvc-3 url-routing

我写过这个网址:

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    routes.MapRoute(
        name: "Class",
        url: "{sectionUrl}/{groupUrl}/{classUrl}",
        defaults: new { controller = "Class", action = "Show" }
    );
    routes.MapRoute(
        name: "Partner",
        url: "{controller}/{action}/{name}",
        defaults: new { controller = "Partner", action = "Show" }
    );
    routes.MapRoute(
        name: "Group",
        url: "{sectionUrl}/{groupUrl}",
        defaults: new { controller = "Group", action = "Show" }
    );
    routes.MapRoute(
        name: "Section",
        url: "{sectionUrl}",
        defaults: new { controller = "Section", action = "Show" }
    );
    routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{name}",
        defaults: new { controller = "Home", action = "Index", name = UrlParameter.Optional }
    );
}

现在,我有两个网址:

~/Internet/ADSL/Unlimited

~/Partner/Show/samplepartner

第一个网址发送正确的参数(根据路由)和页面apears但第二个网址应该使用路由,如PartnerDefault(因为它有一些不同的参数),但它想要使用Class路由并且它失败并且页面不会出现,当我复制并粘贴Partner路由高于Class时,第二个网址会起作用而第一个网址会工作。我应该怎么做办?

非常感谢你。

0 个答案:

没有答案