다음과 같은 문제가 있습니다. 내 솔루션에는 2 개의 컨트롤러가 있습니다 : 홈 및 계정. 모든 것이 지금까지 작동합니다. 하지만 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
부분보기 리포지터리 (repository) 내부 HomeController입니다 수 있도록, 따라서 그보기 ~이/홈/Repository.cshtml는하지만보기의 /에 Shared 또는 Account 폴더에 seacrhed. 위에서 말했듯이 HomeController 클래스 위에 [Authorize]가 없으면 모든 것이 예상대로 작동합니다.
오류가 발생 코드는
@Html.Partial("Repository")
감사합니다 도움을 _Layout.cshtml입니다.
좋아, 지금 감사합니다. – user433947