对于我网站上的某些页面,例如登录页面,我希望用户看到login.htm
,而不是/Home/Login
.
我试过创建这样的路线:
routes.MapRoute(
name: "LoginScreen",
url: "login.htm",
defaults: new { controller = "Home", action = "Login" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
每当我尝试访问 /login.htm 时,都会收到 404。