Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove support for view engines that I don't use?

It's my understanding that:

in debug mode, you can increase performance by removing support for view engines that you are not actually using (e.g. WebForms)

I'd like to do this for my application as the only view engine I use is Razor. How can I do this?

like image 421
Samantha J T Star Avatar asked Dec 07 '11 14:12

Samantha J T Star


People also ask

How can we remove the default view engine?

Removing the Web Form (ASPX) view engine We can remove all the view engines and add only Razor view engine by using Application_Start event of Global. asax. cs file like as: protected void Application_Start() { //Remove All Engine ViewEngines.

What is a view engine?

The View Engine in ASP.NET is used to translate our views to HTML and then render them to the browser. By default, ASP.Net supports ASPX and the Razor View Engine. The view engine templates have a different syntax than the implementation.


1 Answers

Place this in the Application_Start method in Global.asax.cs:

ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
like image 70
SLaks Avatar answered Oct 03 '22 04:10

SLaks