有一个带有标准 Asp.Net (aspx) 页面的项目,与 MVC 3 Razor 控制器/视图一起运行。想要将aspx页面设置为默认页面。目前,打开根目录时它会选择以下路线
routes.MapRoute(
"MVCDefault", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
(它现在托管在 IIS7 中,在 Visual Studio 中运行良好)。
正如您在此处看到的:混合 ASP.NET / ASP.NET MVC 应用程序中的 Index.aspx
routes.MapPageRoute("DefaultPage", "", "~/Index.aspx");
routes.IgnoreRoute("{resource}.aspx/{*pathinfo}");