2013-08-18 38 views
-1

看:布局文件路径被附加在这个错误的路径以查看路径

Exception Details: System.Web.HttpException: The layout page "~Areas/SongTracker/Views/Shared/_HomeLayout.cshtml" could not be found at the following path: "~/Areas/SongTracker/Views/Home/~Areas/SongTracker/Views/Shared/_HomeLayout.cshtml".

这是在查看_viewstart.cshtml文件 - >主目录

@{ 
Layout = "~Areas/SongTracker/Views/Shared/_HomeLayout.cshtml"; 
} 

为什么它将布局文件路径附加到视图目录路径?请注意,视图目录位于MVC4项目的一个区域中。

这是我的注册路线从功能的global.asax.cs(这里默认的东西):

protected void Application_Start() 
    { 
     AreaRegistration.RegisterAllAreas(); 

     WebApiConfig.Register(GlobalConfiguration.Configuration); 
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 
     RouteConfig.RegisterRoutes(RouteTable.Routes); 
     BundleConfig.RegisterBundles(BundleTable.Bundles); 

    } 

回答

0

好吧,我想通了。我错过了/像这样〜:

"~/Areas/SongTracker/Views/Shared/_HomeLayout.cshtml"