MapMvcAttributeRoutes起始页面

时间:2018-09-01 13:12:06

标签: asp.net-mvc routes

我的登录页面具有属性路由。如何在routeconfig中将该页面设置为应用程序的起始页面?

我的RouteConfig

public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.LowercaseUrls = true;

        routes.MapMvcAttributeRoutes();

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Login", action = "Login", id = UrlParameter.Optional }
        );
    }

我的控制器:

[Route("Login")]
    [HttpGet]
    public ActionResult Index()
    {
        return View();
    }

如果我更改了

action = "Login"

收件人

action = "Index"

它仍然不起作用。

0 个答案:

没有答案
相关问题