- Razor View Engine
- Web Form/Aspx View Engine
Differences between Razor And ASPX View Engin:
with ASP.NET MVC
- Razor View Engine is an advanced view engine and introduced with MVC3. This is not a language but it is a markup syntax.
- ASPX View Engine is the default view engine for the ASP.NET MVC that is included with ASP.NET MVC from the beginning.
- Razor View Engine supports System.Web.Razor.
- ASPX View Engine supports System.Web.Mvc.WebFormViewEngine.
- In Razor View Engine we use Layouts.
- In ASPX View Engine we use masterPages.
- In Razor View Engine we use PartialPage.
- In ASPX View Engine we use WebUserControls.
- Razor View Engine has .cshtml (with C#) and .vbhtml (with VB) extension for views, Layout and Partial views.
- ASPX View Engine has a similar extension as in a simple web application like .aspx for the views, .acsx for UserControls and .master for Master Pages.
- Razor Engine is a little slow compared to Aspx Engine.
- Aspx Engine is faster compared to Razor Engine.
- ‘@’ symbol uses in Razor Engine to write the code. @Html.ActionLink("Login", "LoginView")
- ‘<%:’ delimiters use as starting point and ‘ %>’ use as ending point. You can write the code between them in ASPX Engine.
Cross-Site Scripting Attacks
- Razor Engine prevents Cross-Site Scripting Attacks, in other words it encodes the script or HTML tags like <,> before rendering to view.
- ASPX Engine does not prevent Cross-Site Scripting Attacks, in other words any script saved in the database will be fired while rendering the page.