我有以下问题。在我的解决方案中,我有两个控制器:家庭和帐户。一切工作到目前为止。但是,当我添加[授权]以上的HomeController如ASP.NET MVC 3部分视图未找到
[Authorize]
public class HomeController : Controller
{
...
我得到
System.InvalidOperationException: The partial view 'Repository' was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Account/Repository.aspx
~/Views/Account/Repository.ascx
~/Views/Shared/Repository.aspx
~/Views/Shared/Repository.ascx
~/Views/Account/Repository.cshtml
~/Views/Account/Repository.vbhtml
~/Views/Shared/Repository.cshtml
~/Views/Shared/Repository.vbhtml
局部视图仓库里面的HomeController所以因此它认为是在〜/浏览/首页/ Repository.cshtml,但它是分享在共享或帐户文件夹中。正如我所说,如果没有[Authorize]上面的HomeController类,一切都按预期工作。
发生错误的代码是在_Layout.cshtml
@Html.Partial("Repository")
感谢您的帮助。
好吧我现在明白了,谢谢。 – user433947 2011-04-11 21:59:35