I have following problem. In my solution I have 2 controllers: Home and Account. Everything works so far. But when I add [Authorize] above HomeController eg
[Authorize]
public class HomeController : Controller
{
...
I get
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
Partial view Repository is inside HomeController so therefore its View is in ~/Views/Home/Repository.cshtml, but it's seacrhed in Shared or Account folders. As I said, if there is no [Authorize] above HomeController class, everything works as expected.
The code where error occurs is in _Layout.cshtml
@Html.Partial("Repository")
Thanks for help.