2011-12-27 110 views
6

我有項目結構(見下文)。當我啓動該項目時,出現此錯誤(請參閱下文)。你能告訴我,我必須做的改變,我想,當我開始這個項目去MyAreas1 \首頁如何設置默認打開頁面到區域的動作

感謝,

錯誤消息: 視圖「索引」或它的主人沒有找到或沒有視圖引擎支持搜索的位置。以下地點搜索:

~/Views/Home/Index.aspx 
~/Views/Home/Index.ascx 
~/Views/Shared/Index.aspx 
~/Views/Shared/Index.ascx 
~/Views/Home/Index.cshtml 
~/Views/Home/Index.vbhtml 
~/Views/Shared/Index.cshtml 
~/Views/Shared/Index.vbhtml 

enter image description here

回答

3

您必須Global.asax文件

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

所以,你需要的是編輯您的默認路由設置指定的路由。

+0

樣品,請... – 2011-12-27 13:43:29

+0

檢查我的編輯答案.. – 2011-12-27 13:44:48

+0

當我這樣做,我有這樣的錯誤:「HTTP錯誤404.20 - 未找到」 – 2011-12-27 13:49:33

1

嘗試在項目右鍵點擊>>性能>>網絡>> 現在檢查的具體頁面選項,並鍵入controllerName/ActionName

0

routes.MapRoute( 「區域」, 「」 , new {area =「AreaName」,controller =「ControllerName」,action =「ActionName」} );