Removing unused view engines from of ASP.NET MVC application

ASP.NET MVC framework brings to life application component called “view engine”. Simply, view engine is markup language for your applications dynamic pages. You can register any number of view engines per application.

ASP.NET MVC framework default configuration enables ASPX and Razor view engines in your application. ASPX view engine is used in ASP.NET Web Forms framework from the beginning of ASP.NET framework. Razor is newly created view engine developed for ASP.NET MVC framework.

If you aren’t planning to use ASPX view engine in your application, which, by the way, is quite a common scenario, you can easilly remove it from your application and request pipeline entirely.

Firstly, all you have to do is to clear already registered view engines list from application. Go to Global.asax file, Application_Start() method. Secondly, register only Razor view engine.

You can check result by doing request to none existing web page. In picture below both view engines enabled.

1

Only Razor view engine enabled.

2

Your questions or comments are welcome. Any ideas on impact for application performance?

Leave a Reply

Your email address will not be published. Required fields are marked *