Get MVC Razor in favor of .cshtml over .aspx

I completely converted the site to Razor and want it to ignore any residual .aspx files. This caused problems using

  • not removed from the production server and
  • recreated by NuGet packages. In this case, ASPX takes precedence, and any setting to the equivalent CSHTML file does not play.

I would like to tell the whole site to stop processing ASPX or ASCX pages and use only Razor views.

+4
source share
1 answer

Add to Global.asax.cs

the following information:
protected void Application_Start() { ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new RazorViewEngine()); } 

By default, a WebFormViewEngine enabled BEFORE RazorViewEngine .

+4
source

Source: https://habr.com/ru/post/1385368/


All Articles