Difference between asp.net web forms and asp.net mvc

4,603 views
4,368 views

Published on

Difference between ASP.NET WebForms and ASP.NET MVC

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,603
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
32
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Difference between asp.net web forms and asp.net mvc

  1. 1. S.No ASP.NET WebForms ASP.NET MVC 1 What approach or pattern it uses ? ‘Page Controller’ pattern. What approach or pattern it uses ? ‘Front Controller’ pattern. What does it mean? Each page has a code-behind class that acts as a controller and is responsible for rendering the layout. What does it mean? There is a single central controller for all pages to process web application requests and facilitates a rich routing architecture Is it loosely or tightly coupled ? Tighltly coupled. Is it loosely or tightly coupled ? Loosely coupled. How do you say it is tightly coupled ? Uses an architecture that combines the Controller (code behind) and the View (.aspx). Thus the Controller has a dependency on the View. How do you say it is loosely coupled ? The Model does not know anything about the View. The View does not know there’s a Controller. 2 What is the disadvantage of tightlycoupled behaviour of ASP.NET WebFoms w.r.t Test-Driven Development(TDD)? Because of this tightly-coupled behavior, automated testing is really difficult. What is the advantage of loosely-coupled behaviour of ASP.NET MVC w.r.t TestDriven Development(TDD)? Test driven development becomes easy because of loosely-coupled behaviour of ASP.NET MVC. i.e., We ‘can’ test our Controller without instantiating a View and carry out unit-tests without having to run the controllers in an ASP.NET process. 3 How we can do State Management in ASP.NET WebForms? ASP.NET WebForms manage state by using view state and server-based controls. How we can do State Management in ASP.NET MVC? ASP.NET MVC does not maintain state information by using view state.But, it uses light-weight state management mechanism such as: ViewBag, ViewData and TempData besides existing QueryString, HiddenFields and Session states. 4 Whether we can have full control over ASP.NET WebFoms? No Whether we can have full control over ASP.NET MVC? Yes Why we cannot have full control over ASP.NET WebForms? WebForms supports an event-driven programming style that is like Windows applications and is abstracted from the user. How do you say in ASP.NET MVC, we can have full control ? As controller and view are not dependent and also no viewstate concept in ASP.NET MVC, so output is very clean. The State management is made transparent by using sessions, viewstate etc. No event-driven Page Life cycle like WebForms. Request cycle is simple in ASP.NET MVC model. The HTML output is not clean making it difficult to manage later. Full control over HTML, JavaScript and CSS.
  2. 2. The ViewState also increases the page size. 5 Learning Curve ? Learning Curve ? Relatively simple to learn and pickup. There is a learning curve to understand the Works very well for developers who initially why, when and how of ASP.NET MVC. have trouble with the HTTP/HTML model and are coming from a similar WinForms oriented event model. 6 Amount of programming code required ? Lesser amount of code is required to build webapps since a lot of components are integrated and provided out of the box. We can also use a lot of data controls provided out of the box that rely on ViewState. Amount of programming code required ? Since the application tasks are separated into different components, amount of code required is more. Since ASP.NET MVC does not use ViewState, we cannot use Data controls like GridView, Repeater. 7 Where to use ? Works very well for small teams where focus is on rapid application development Where to use ? Works well for large projects where focus in on testability and maintainability 8 What syntax it uses ? ASP.NETWebForms follow Web Forms Syntax What syntax it uses ? ASP.NET MVC follows customizable syntax (Razor as default) 9 What controls are used in coding ASP.NET WebForms? Server controls. What controls are used in coding ASP.NET MVC? Html helpers. 10 What URL Mapping technique is used in What URL Mapping technique is used in ASP.NET WebForms ? ASP.NET MVC ? URL Rewriting ASP.NET Routing i,e., ASP.NET WebForms has file-based URLs means file name exist in the URLs must have its physically existence. i.e., ASP.NET MVC has route-based URLs means URLs are divided into controllers and actions and moreover it is based on controller not on physical file. 11 What is used to maintain look and feel in What is used to maintain look and feel in ASP.NET WebFoms? ASP.NET MVC? Master Pages Layouts 12 What is used for code reusability? User Controls 13 Whether it is Open Source or Licensed ? Whether it is Open Source or Licensed ? ASP.NET WebForms is not an Open Source. ASP.NET MVC is an Open Source. 14 Page Life Cycle (Event-based): i.Page_PreInit ii.Page_Init iii.Page_InitComplete iv.Page_PreLoad v.Page_Load vi.Page_Control vii.Page_LoadComplete viii.Page_PreRender ix.Page_SaveStateComplete x.Page_Render What is used for code reusability? Partial Views Page Life Cycle (Process-based): i. App Initialization ii. Routing iii. Instantiate and execute controller iv. Locate and invoke controller action v. instantiate and render view
  3. 3. xi.Page_Unload Reference: http://onlydifferencefaqs.blogspot.in/2014/02/difference-between-aspnet-webforms-and.html

×