3

我有一个 MVC4 Webapp (1),它下面有一个虚拟目录,其中包含另一个独立的 Webapp,如下所示:

 MainApp
     Areas
         SUBAPP  <------ THIS is a Virtual Directory with its own Webapp
             Views
                 _Layout_2.cshtml
     Views
         _Layout_1.cshtml

现在我想从 MAINAPP 管理 SUBAPP 的布局,例如:

  _Layout_2.cshtml:
  @{
     Layout = "../../Views/_Layout_1.cshtml
   }

....这给了我错误:

  The virtual path '/Views/_Layout_1.cshtml' maps to another application,
  which is not allowed

我怎么能做到这一点???

4

1 回答 1

0

您是否尝试将该布局放在 /Views/Shared 文件夹中?

也可以尝试使用MEF框架

http://msdn.microsoft.com/it-it/library/hh708870%28v=vs.110%29.aspx

安装起来真的很简单,您可以连接其他项目和其他解决方案的视图和控制器(它就像一个插件)

于 2013-11-08T15:17:55.890 回答