View Engine renders the view into HTML form to the browser. If we talk about a MVC application in the .Net Framework, it supports the following 2 view engines:
- Razor View Engine
- Web Form/Aspx View Engine
Differences
- Entry 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.

- Namespace
- Razor View Engine supports System.Web.Razor.
- ASPX View Engine supports System.Web.Mvc.WebFormViewEngine.
- Layout /MasterPage
- In Razor View Engine we use Layouts.
- In ASPX View Engine we use masterPages.

- PartialPage /WebUserControl
- In Razor View Engine we use PartialPage.
- In ASPX View Engine we use WebUserControls.

- Extension
- 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.

- Performance
- Razor Engine is a little slow compared to Aspx Engine.
- Aspx Engine is faster compared to Razor Engine.
- Syntax
- ‘@’ 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.
<%: Html.ActionLink("Login ", " LoginView ") %>

- 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.

Kumaresan MurugesanPosted Sep 22, 2021, 12:15 PM
Explanation is very clear. Thank you
Sridhar saminathanPosted Apr 12, 2018, 5:35 AM
Thanks for the article
naseema karkhaniPosted Sep 17, 2017, 9:38 AM
HELLO RAHUL VERY NICE ARTICLE. THANK YOU.
Neo AnPosted Sep 6, 2017, 12:06 AM
It's easy to understand. Thank you, sir.
Shashank RanePosted Aug 3, 2015, 8:28 AM
For a beginner which is more preferable:razor vs aspx engine.Please reply
Amik ShuklaPosted Jun 8, 2015, 6:31 AM
Thank you sir. your article is very easy and help full to understand.
Arweb AroshanzamirPosted Jan 23, 2015, 7:58 AM
the best....very informative..thanks sir ...
Rahul BansalPosted Jan 23, 2015, 3:34 AM
I am not sure about it, Might be because of ASPX Engine syntax is look a like old asp code which doesn't need extra conversion but Razor Engine syntax is different which takes time for the conversion or some make the understandable easily by the compiler.
Bhushan GawalePosted Jan 23, 2015, 3:15 AM
Nice article, Thanks for sharing. About 6. why is that the razor induces the slowness ? any reason you are aware of?
karthik.ePosted Jan 23, 2015, 1:11 AM
very nice..