Click here to Skip to main content
15,878,871 members
Please Sign up or sign in to vote.
1.11/5 (2 votes)
See more:
Hi,

i have no idea what is the difference between Razor view Engine and Asp.Net Engine and
what are the disadvantages of Asp.net.
why Viewstate is disadvantage of ASp.Net please give me full on it.
Tanking you.
Posted

Razor View Engine
1. Razor Engine is an advanced view engine that was introduced with MVC3. This is not a new language but it is a new markup syntax.

2. The file extensions used with Razor Engine are different from Web Form Engine. It has .cshtml (Razor with C#) or .vbhtml (Razor with VB) extension for views, partial views, editor templates and for layout pages.

3. Razor has new and advance syntax that are compact, expressive and reduces typing.

4. Razor syntax are easy to learn and much clean than Web Form syntax. Razor uses @ symbol to make the code like as:

@Html.ActionLink("SignUp", "SignUp")

5. Razor Engine support TDD (Test Driven Development) since it is not depend on System.Web.UI.Page class.

Web Form View Engine

1. Web Form Engine is the default view engine for the Asp.net MVC that is included with Asp.net MVC from the beginning.

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

3. Web Form Engine has the same syntax like Asp.net Web Forms uses for .aspx pages.

4.
XML
Web Form syntax are borrowed from Asp.net Web Forms syntax that are mixed with html and sometimes make a view messy. Webform uses <% and %> delimiters to make the code like as:

 <%: Html.ActionLink("SignUp", "SignUp") %>


5. Web Form Engine doesn't support TDD (Test Driven Development) since it depend on System.Web.UI.Page class which makes the testing complex.
 
Share this answer
 
Comments
Dholakiya Ankit 10-Aug-13 7:16am    
nice one
Read more here[^] and here[^].

This[^] might give some additional information as well.
 
Share this answer
 
v2
The main differences is the script you are using in asp.net engine "<%%>" and Razor view "@"

It is more easy to write code with Razor view as programmer not need to end the tag

programmer can easily add the scripting code with HTML code

as MVC is open source other view engines are also available like :Spark

The major differences are nothing but all those are develop to make programmer life easy

you can refer:http://ironshay.com/post/The-Big-View-Engine-Comparison-e28093-Razor-vs-Spark-vs-NHaml-vs-Web-Forms-View-Engine.aspx[]

We know that HTTP is state less, It is not able to store the any information once the form is posted to server although asp.net even we are postback the form to sever It preserve the status of each sever side control

The asp.net is using viewstate to preserve the asp.net control's status on post back.
asp.net added viewstate extra code for each server side control you used
It will increases the HTML code (response that send to client)and hit the performance of application
so it advisable to not to use the viewstate for the control which value not require to preserve on server postback
 
Share this answer
 
Comments
Madhugundi 1-Mar-12 4:54am    
Thank you
Diference between Razor and .aspx:
1.The ASP.NET view engines processes web pages, looking for special elements that contain server-side instructions. As we already know the standard ASPX view engine relies on the <% and %> elements, which is familiar to all ASP.NET developers. But with Razor View Engine, the MVC development team has introduced a new set of syntax elements, centered on the @ symbol.
2. Razor views have a file extension of .cshtml.

Disadvantges of Viewstate:
1. Does not track across pages. ViewState information does not automatically transfer from page to page. With the session
approach, values can be stored in the session and accessed from other pages. This is not possible with ViewState, so storing
data into the session must be done explicitly.

2. ViewState is not suitable for transferring data for back-end systems. That is, data still has to be transferred to the back
 
Share this answer
 
v2
Comments
Madhugundi 1-Mar-12 4:54am    
Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900