ASP.NET MVC How to specify which folder the View pages reside in?

后端 未结 2 1739

by default the ASP.NET MVC engine searches the following folders for View pages:

  • /Views/{Controller_Name}/{Action}.aspx
  • /Views/
2条回答
  •  粉色の甜心
    2020-12-01 10:58

    You can return view placed in custom sub-folders, from controller action by, giving out full view path in return statement,

    ex.

    public ActionResult Create()
    {
        return View("~/Views/ProEnhance/Employee/Create.cshtml");
    }
    

    here,

    ProEnhance - user defined folder

    Employee - Controller Name

    Create - action Name

提交回复
热议问题