MVC Areas - View not found

前端 未结 8 1489
盖世英雄少女心
盖世英雄少女心 2020-12-15 08:35

I have a project that is using MVC areas. The area has the entire project in it while the main \"Views/Controllers/Models\" folders outside the Areas are empty barring a dis

8条回答
  •  难免孤独
    2020-12-15 09:03

    Add the RouteArea attribute on the Controller class so MVC knows to use the "XYZ" Area for the views (and then you can set the AreaPrefix to empty string so routes do not need to start with "XYZ").

    [RouteArea("Xyz", AreaPrefix = "")]
    public class XyzController : Controller   
    {
    ...
    }
    

提交回复
热议问题