Remove Unused View Engine
If an application doesn’t have specific requirements to use both the Web Form View Engine and the Razor View Engine, it is better to remove the Web Form View Engine. We first remove all the view engines, using clear method. Thereafter, we add the Razor View Engine in the application. We update Application_Start method of Global.asax file to remove unused view engines, as shown in the following code.
protected void Application_Start()
{
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
//Enabling Bundling and Minification
BundleTable.EnableOptimizations = true;
}
Edited on 6th July 2023
No comments:
Post a Comment