Why ASP MVC is much better than ASP.Net WebForms?

asp.net vs mvc
If you are or you want be Asp Web developer, you must know about ASP.Net MVC and reasons why it is much better than ASP.NET Web Forms.

ASP.NET is a biggest success of Microsoft and it successfully delivered Web Application for past 12 years. It is easier for web developer to develop web forms using asp.net than other architecture. A developer can drag and drop control onto web forms and visual studio automatically generates event based code behind control. So, the programmer can easily write code on the click_event of control. It seems so pleasant to developing project over asp.net but there are some serious problem with asp.net so, Microsoft decided to overcome these problems by launching ASP.Net MVC.

1

So, whats the problem with ASP.Net?

There are some serious problem with ASP.Net architecture that is listed below.

  1. Performance Issue: net has slower server response, huge and complex page cycle life and consumes heavy bandwidth.
  2. Server Control: If you are an asp.net developer you might know about server control. Now, the simple question is why need to server control if you have light weight html control in hand. Microsoft cleverly shows you that you are working on event driven programming architecture but in reality a server control converts itself into a simple control. For example:

ASP.NET VS MVC

If you drag a text box in web forms you see the following code in .aspx file


But what actually happened behind it? If you see the original output of the above code you get this code.

So, the question is why need to do more server trip for a simple control if you have handy html control to work. And just imagine what happened if you have dozens of control on the page. The page becomes slow and unresponsive several time. It is a biggest headache for end user.  So, the solution is get rid of Server Control.

Introducing ASP.net MVC

Now, let’s discuss about ASP.net MVC Architecture.  MVC stands for Model, View and Controller.

Model: It is middle layer between View and Controller.

View: It is pure HTML Design

Controller: It contains all the coding logics.

So, How MVC works?

Steps 1: User first clicks a button and the request goes to controller. Don’t forget that controller is an area where your programming logic resides.

Steps 2: Based on request Controller creates the object of the Model. Model invokes data access layer which fetches data in the Model.

Steps 3: Now the model which is loaded with data; passed to view for display purpose.

Features of ASP.Net MVC

  1. It is lightweight and follows Model, View and Controller based architecture.
  2. It has not server control instead a designer can design a page in pure HTML and CSS.
  3. Microsoft removes View State in MVC.
  4. In MVC, Views and Logic are kept separately.
  5. It has no Master Page instead MVC has Layouts for consistent look and feels.
  6. Net MVC is an Open Source.

Suggestion:

In my suggestion if you are an ASP.Net Developer you must upgrade yourself with MVC. For Beginner -skip learning ASP.Net Web Forms (because it is outdated) and start learning MVC.



Leave a Reply

Your email address will not be published. Required fields are marked *