【发布时间】:2018-08-12 17:29:26
【问题描述】:
我正在使用带有重写 MasterLocationFormats 的自定义剃须刀视图引擎。我想为搜索视图和母版页提供相对虚拟路径位置。
如何做到这一点?
public class ExampleRazorViewEngine : RazorViewEngine
{
/// <summary>
/// Initializes a new instance of the <see cref="ExampleRazorViewEngine"/> class.
/// </summary>
public ExampleRazorViewEngine()
{
ViewLocationFormats = new string[] {
"../../../Views/{1}/{0}.cshtml",
};
MasterLocationFormats = new string[] {
"../../../Views/{1}/{0}.cshtml",
};
PartialViewLocationFormats = new string[] {
"../../../Views/{1}/{0}.cshtml",
};
FileExtensions = new string[] { "cshtml" };
}
执行此操作时会出现以下错误。
相对虚拟路径..
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-mvc-4 razor