如何将MVC Areas中的某一个页设为起始页

时间:2023-11-25 22:13:02

area的默认页:

 routes.MapRoute(
name: "MyArea",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "MvcWeb.Areas.Members.Controllers" }
).DataTokens.Add("Area", "Members");

设置默认控制器:

 routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Login", action = "Index", id = UrlParameter.Optional }
);