我想在 Asp.net mvc 中添加自定义默认页面,所以页面转到 Home/Index ,我想转到 Account/Login。我已经实现了以下,但它仍然去主页/索引。请告知我做错了什么。谢谢
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Custom",
url: "{controller}/{Account}/{page}",
defaults: new
{
category = UrlParameter.Optional,
page = 1,
action = "Login"
},
constraints: new
{
controller = "Account"
}
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}