I have one of these annoying issues which are very simple and still I can't seem to find the problem.
I have a simple 'test' controller. here is the code:
public class testController : Controller
{
//
// GET: /test/
public ActionResult Index(int id)
{
ItemModel item = null;
item = CommonLib.ReturnFullItem(id);
return View("~/Views/Emails/ItemRecordedEmail", item);
}
}
and I do have the folder /Views/Emails/ with ItemRecordedEmail.cshtml view inside. But I get the following error message:
The view '/Views/Emails/ItemRecordedEmail' or its master was not found or no view engine supports the searched locations. The following locations were searched: /Views/Emails/ItemRecordedEmail
when I move the ItemRecordedEmail.cshtml to some shared folder and change the code accordingly everything seems to work fine. Any ideas what do I do wrong?
EDIT: I changed the path to '~/Views/Emails. This was the original path, I accidently left it out after all the tries I made. Still the same problem with the same error message, only this time it looks for it in the '~/Views/Emails' folder.
return View("~/Views/Emails/ItemRecordedEmail", item);