在我的项目中,初始路由配置如下
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Login", id = UrlParameter.Optional }
);
}
现在我改为
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Pro123", action = "Index", id = UrlParameter.Optional }
);
}
然后我重建解决方案并再次运行它@本地系统。它仍然会进入 Home 控制器的 Login 视图。我错过了什么吗?