我有以下問題。在我的解決方案中,我有兩個控制器:家庭和帳戶。一切工作到目前爲止。但是,當我添加[授權]以上的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