Reputation: 287390
I'm trying to access a view in this way:
return View(@"~\Items\Details.aspx");
and I get this error:
The view '~\Items\Details.aspx' or its master could not be found. The following locations were searched: ~\Items\Details.aspx
On the ItemsController, in the Details action, returning View() works just fine. Why can't I access that view from another controller?
Upvotes: 12
Views: 9961
Reputation: 27323
Prefix it with '/Views' should help.
return View("~/Views/Items/Details.aspx");
Upvotes: 23
Reputation: 24182
You can make the Items view a shared one (you put it in the Views/Shared folder), then you can just call View("Items") and it will work.
Upvotes: 1