【发布时间】:2013-01-18 19:56:20
【问题描述】:
对于我的大部分网站,我希望正常路由以 MVC 方式发生。但是,当应用程序首次启动时,我不希望路由转到 /Home/Index.cshtml。我希望它简单地转到 /Index.html
我当前的 RegisterRoutes 看起来像这样(并没有达到我的目标)
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("index.html");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
【问题讨论】:
-
我问了一个奇怪的问题吗?希望有一个简单的答案
-
这个答案是你想要的。 stackoverflow.com/questions/12417437/…
标签: asp.net-mvc-4 asp.net-mvc-routing