in Education by
What is difference between MVC and Web Forms?

1 Answer

0 votes
by

ASP.Net MVC / Web Forms difference

 
The following are some difference.
 

ASP.Net MVC ASP.Net Web Forms
View and logic are separate, it has separation of concerns theory. MVC 3 onwards has .aspx page as .cshtml. No separation of concerns; Views are tightly coupled with logic (.aspx.cs /.vb file).
Introduced concept of routing for route based URL. Routing is declared in Global.asax for example. File-based routing .Redirection is based on pages.
Support Razor syntax as well as .aspx Support web forms syntax only.
State management handled via Tempdata, ViewBag, and View Data. Since the controller and view are not dependent and also since there is no view state concept in ASP.NET, MVC keeps the pages lightweight. State management handled via View State. Large viewstate, in other words increase in page size.
Partial Views User Controls
HTML Helpers Server Controls
Multiple pages can have the same controller to satisfy their requirements. A controller may have multiple Actions (method name inside the controller class). Each page has its own code, in other words direct dependency on code. For example Sachin.aspx is dependent on Sachin.aspx.cs (code behind) file.
Unit Testing is quite easier than ASP.Net Web forms Since a web form and code are separate files. Direct dependency, tight coupling raises issues in testing.
layouts Master pages

Related questions

0 votes
    How do you implement Forms authentication in MVC?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
    What is the difference between Server.Transfer and Response.redirect?...
asked Apr 7, 2021 in Education by JackTerrance
0 votes
    What is the difference between HttpContext.Current.Items and HttpContext.Current.Session in ASP.NET?...
asked Apr 7, 2021 in Education by JackTerrance
0 votes
    What is the Difference between session and caching?...
asked Apr 7, 2021 in Education by JackTerrance
0 votes
    What is Bundling and Minification in MVC?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
0 votes
    What are the methods of handling an Error in MVC?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
    What are the Folders in MVC application solutions?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
    What is Database First Approach in MVC using Entity Framework?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
0 votes
0 votes
0 votes
    What is Route Constraints in MVC?...
asked Apr 5, 2021 in Education by JackTerrance
...