Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

asp.net-mvc

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 I cannot use razor and the web forms view engine in the same project?

like image 857
dagda1 Avatar asked Jan 20 '11 05:01

dagda1


1 Answers

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

like image 175
David Glenn Avatar answered Oct 04 '22 13:10

David Glenn