我写过这个网址:
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但第二个网址应该使用路由,如Partner
或Default
(因为它有一些不同的参数),但它想要使用Class
路由并且它失败并且页面不会出现,当我复制并粘贴Partner
路由高于Class
时,第二个网址会起作用而第一个网址会工作。我应该怎么做办?
非常感谢你。