I started learning ASP.NET MVC3.
So, while reading tutorials online and in books, I came across this term \"view engine\" quite frequently. I don\'t know
In ASP.Net MVC, View engine is the one that works between your view and browser to provide valid HTML output to your browser by considering output provided by your view.There are many types of view engines.
1)ASPX
2)Razor
3)Spark
4)NHaml
5)NDJango
6)Hasic
7)Brail
I read a descriptive post at http://questionbox.in/view-engine-asp-net-mvc-razor-view-engine-asp-net-mvc-web-form-aspx-view-engine-asp-net-mvc/
View engine gives the ability to render the HTML from your view to the browser.
There are many view engines supported by ASP.NET MVC but the most widely used view engines are
Web form view engine / ASPX view engine:
.aspx, for Views just like Web Form pages. .ascx, for Partial Views & Editor Template just like User Controls. .master, for Layout and Master Pages just like Master Pages in Web Forms.
Razor View Engine:
Razor syntax is easy to understand and much clean than Web Form syntax. Razor uses @ symbol to make the code like as:
@Html.ActionLink(“Home”, “Index”)
In MVC, View engine is the one that works between your View and browser to provide valid HTML output to your browser by compiling the code inside your View. There are many view engines available and some of them are following:
ASPX
Razor
Spark
NHaml
NDJango
Hasic
Brail
Bellevue
Sharp Tiles
String Template
Wing Beats
SharpDOM
Currently most developers prefer to use Razor view engine as it provides very convenient way of programming. All of these view engines may not support ASP.NET MVC.
For more details you can visit this article.
View Engine renders the view into HTML form to the browser. If we talk about an MVC application in the .Net Framework, it supports the following 2 view engines:
1. Razor View Engine 2. Web Form/ASPX View Engine
Differences : 1. Razor View Engine uses Layouts but ASPX view engine uses Master pages.
2. Razor View Engine uses partial page but ASPX view engine uses Web User Control.
3. Razor view engine is not a language, It is Markup syntax.
4. @’ 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.
5. 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.