2012-04-13 122 views
0

獲得了一個與MVC 3 Razor控制器/視圖一起運行的標準Asp.Net(aspx)頁面的項目。想要將aspx頁面設置爲默認頁面。截至目前它打開根如何設置MVC默認頁面?

routes.MapRoute(
"MVCDefault", // Route name 
"{controller}/{action}/{id}", // URL with parameters 
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults 
); 

(它現在IIS7託管它工作得很好捉迷藏在Visual Studio中),當在撿下面的路線。

回答

3

正如你可以在這裏看到:Index.aspx in a hybrid ASP.NET/ASP.NET MVC application

routes.MapPageRoute("DefaultPage", "", "~/Index.aspx"); 
routes.IgnoreRoute("{resource}.aspx/{*pathinfo}"); 
+0

其實,我只是發現使用自定義的路由處理和使用routes.add一個解決方案,但你的解決方案看起來更加雄辯。 – John 2012-04-13 06:09:38

+2

並將這些行放在其他MapRoutes中。 – 2012-04-13 06:10:06