定义了几个路由
routes.MapRoute(
name: "AssetModule",
url: "AssetModule/{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new string[] { "PDRZ.IntegrationController.School.AssetModule" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new string[] { "PDRZ.IntegrationController.School" }
);
然后页面
@Html.ActionLink("首页", "Index","Home") 生成的href 居然是href="/AssetModule
我想要的是 /Home/Index 这个要怎么处理?
改成 Html.RouteLink 就可以了。