I downloaded Glimpse this morning to try it out and noticed this when I click on the views tab:
It checks all of the loaded view engines. I found where the RazorViewEngine
is specified in web.config, but I couldn't find where the WebFormViewEngine
was. Since I know my project will never have an web form view in it,
WebFormViewEngine
?WebFormViewEngine
?Razor has new and advance syntax that are compact, expressive and reduces typing. Web Form Engine has the same syntax like Asp.net Web Forms uses for . aspx pages. By default, Razor Engine prevents XSS attacks(Cross-Site Scripting Attacks) means it encodes the script or html tags like <,> before rendering to view.
Removing the Web Form view engine is easy in MVC. We can remove all the view engines and add only Razor view engine by using Application_Start event of Global.
Aspx Engine is faster compared to Razor Engine.
View Engine works inside the application for rendering HTML page to the browser or to the user. It can contain HTML tags, server controls and some programming language. Razor is preferred view engine for MVC4 framework.
It is perfectly OK to remove the web forms view engine 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 in your global.asax
file.
source of code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With