Difference between Razor View Engine and ASPX View Engine
View Engine is responsible for rendering the view into html form to the browser. Or other words we can say that view engine render html into browser .The view engine templates have a different syntax than the implementation. MVC supports ASPX and the Razor View Engine by default. MVC supports many third party engines view engine like Spark, Nhaml and so on.
Razor View Engine
|
ASPX View Engine
|
Razor View Engine is an advance view engine that introduce in MVC 3.0 version and later .It’s not a new language but new markup syntax.
|
ASPS view Engine is introduce with first version of MVC and it is by Default view engine.
|
The namespace used by the Razor View Engine is System.Web.Razor
|
The namespace used by the ASPX View Engine is System.Web.Mvc.WebFormViewEngine
|
The file extensions used with Razor Engine are different from Web Form Engine. It has .cshtml with C# or .vbhtml with VB extension for views, partial views and editor templates and for layout pages.
|
The file extensions used with Web Form Engine are also like Asp.net Web Forms. It has .aspx extension for views, .ascx extension for partial views & editor templates and .master extension for layout/master pages.
|
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.
|
The Razor View Engine uses @ to render server-side content.
|
The ASPX/web form view engine uses "<%= %>" or "<%: %>" to render server-side content.
|
By default all text from @ expression is HTML encoded.
|
There is a different syntax ("<%: %>") to make text HTML encoded.
|
Razor does not require the code block to be closed, the Razor View Engine parses itself and it is able to decide at runtime which is a content element and which is a code element.
|
A web form view engine requires the code block to be closed properly otherwise it throws a runtime exception.
|
Razor Engine prevents XSS attacks (Cross-Site Scripting Attacks) means it encodes the script or html tags like <,> before rendering to view.
|
Web Form Engine does not prevent XSS attacks means any script saved in the database will be fired while rendering the page
|
The Razor Engine supports Test Driven Development (TDD).
|
Web Form view engine does not support Test Driven Development (TDD) because it depends on the System.Web.UI.Page class to make the testing complex.
|
Razor Engine is little bit slowly as compared to Webform Engine.
|
Web Form Engine is faster than Razor Engine.
|
Razor Engine, doesn't support design mode in visual studio means you cannot see your page look and feel.
|
Web Form engine support design mode in visual studio means you can see your page look and feel without running the application.
|
Difference between Razor View Engine and ASPX View Engine
Reviewed by NEERAJ SRIVASTAVA
on
10:45:00 PM
Rating:
No comments: