我试图让 ViewEngine 使用额外的路径:
base.MasterLocationFormats = new string[] {
"~/Views/AddedMaster.Master"
};
在 ViewEngine 的构造函数中。它适用于 aspx 和 ascx(PartialViewLocationFormats,ViewLocationFormats)。
我仍然需要在 web.config 或页面声明中提供 MasterPage。但如果我这样做了,则使用此声明,而不是 ViewEngine 中的声明。如果我使用空 MasterLocationFormats,则不会引发错误。这不是在 RC1 中实现的吗?
编辑:
使用:
return View("Index", "AddedMaster");
代替
return View("Index");
在控制器工作。