Disabling WebFormViewEngine when using a razor?

I downloaded Glimpse this morning to try and noticed this when I click on the views tab:

Glimpse views tab

It checks all loaded viewers. I found where RazorViewEngine is listed in web.config, but I could not find where WebFormViewEngine . Since I know that my project will never take the form of a web form,

  • Is it possible / safe to disable WebFormViewEngine ?
  • How to disable WebFormViewEngine ?
+46
asp.net-mvc webforms razor configuration
May 6 '11 at 14:38
source share
2 answers

It is perfectly normal to remove the web form viewer if you are not using it. You can do it like:

 public class Global : HttpApplication { public void Application_Start() { // Clears all previously registered view engines. ViewEngines.Engines.Clear(); // Registers our Razor C# specific view engine. // This can also be registered using dependency injection through the new IDependencyResolver interface. ViewEngines.Engines.Add(new RazorViewEngine()); } } 

The above method calls go into your global.asax file.

source code

+69
May 6 '11 at 15:08
source share
— -

An alternative would be to remove only the viewer that you want to remove:

  var webformVE = ViewEngines.Engines.OfType<WebFormViewEngine>().FirstOrDefault(); ViewEngines.Engines.Remove(webformVE); 
+13
Aug 12 '13 at 15:57
source share



All Articles