Web forms view engine and razor view engine in the same project

后端 未结 2 1351
旧时难觅i
旧时难觅i 2021-02-16 00:24

I work on a product which up to this point has been using the web forms view engine for all its views. There are far too many files to refactor.

Is there any reason why

相关标签:
2条回答
  • 2021-02-16 00:42

    From Scott Gu:

    You’ll also be able to mix and match view templates written using multiple view-engines within a single application or site.

    Read it on his blog.

    0 讨论(0)
  • 2021-02-16 00:45

    ASP.NET MVC supports the use of both the Razor and WebForms views in the same project with the default configuration.

    The default View engine will search for a view in this order

    ~/Views/Home/Index.aspx (WebForms)
    ~/Views/Shared/Index.aspx (WebForms)
    ~/Views/Home/Index.cshtml (Razor)
    ~/Views/Shared/Index.cshtml (Razor)
    

    So if you have a WebForms and Razor view of the same name then the WebForms view will be shown.

    Scott Hansleman has more details on mixing WebForms and Razor views in one layout/master page

    0 讨论(0)
提交回复
热议问题