I am using ASP.NET MVC 5.2.6 on .NET framework version 4.5.2.
I have an area named Admin in which I have the following:
namespace MyCode.Controllers
{
[RoutePrefix("admin/article")]
public class ArticleController : Controller
{
[Route("new")]
public ActionResult New()
{
return View();
}
}
}
I also have a view named New.cshtml in the Admin area's Views\Article folder.
Areas\Admin\Views\Article\New.cshtml
However, when I run my application, MVC is only looking in the Views folder within my area-less root. From my past experience, it starts to look in the Views folder within the area.
Is it because the new attribute based routing that MVC doesn't know that I am inside the Admin area?
I know I could and I don't want to be providing the full path to each view because that's a pain in the neck. My question isn't, where do I go from here now? It is, as the title says, the following:
Is there a way to tell it to look for views in the area first?