【发布时间】:2012-11-02 15:33:32
【问题描述】:
我第一次在 MVC 中遇到这个。 我在“新闻”中有区域“管理”和控制器,其中包含操作“列表”。
在调试中我在
处得到断点public ActionResult List()
{
return View(); // Breakpoint
}
然后我就到了
但引擎找不到视图“列表”
我收到错误:
The view 'List' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/News/List.cshtml
~/Views/News/List.vbhtml
~/Views/Shared/List.cshtml
~/Views/Shared/List.vbhtml
在位置 Areas/Administation/News/List.cshtml 中查看出口
为什么 Razor 不将区域名称粘贴到视图视图位置?
更新:
我找到了解决方案: ASP.NET MVC Default routes accessible via area routes
Route route = Routes.MapRoute(name, url, defaults, constraints, namespaces);
route.DataTokens["area"] = AreaName;
【问题讨论】:
标签: asp.net-mvc-3