C# MVC 设置起始页

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/TKDwave520/article/details/44573791

Area分区

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

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "SiteInfo", action = "Index", id = UrlParameter.Optional },
                namespaces: new string[] { "Iweb.Areas.SiteInfo.Controllers" }
            ).DataTokens.Add("Area","SiteInfo");
        }



无Area,不分区

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

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


没有更多推荐了,返回首页