62,046
社区成员
发帖
与我相关
我的任务
分享
public class CustomViewEngine:RazorViewEngine
{
private static string[] viewFormats = new[] {
"~/Views/{1}/subpart/{0}.aspx",
"~/Views/{1}/subpart/{0}.ascx"
};
public CustomViewEngine()
{
base.ViewLocationFormats = base.ViewLocationFormats.Union(viewFormats).ToArray();
}
}
ViewEngines.Engines.Add(new CustomViewEngine());
public class testController:Controller
{
public ActionResult Index()
{
return View();
}
}
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<!DOCTYPE html>
<html>
<head runat="server">
<meta name="viewport" content="width=device-width" />
<title></title>
</head>
<body>
<div>
<p>ddddddd</p>
</div>
</body>
</html>
"~/Views/subpart/{1}/{0}.aspx"