• home
  • Email: trainings@synapseindia.careers

Blogs

back

How ASP.NET MVC is different from ASP.NET Web Forms

Aug 25, 2015

Microsoft introduced ASP.NET for first time in 2002. That time developers had a single programming model called Web Forms that allowed them to quickly build web applications in a way that was familiar to them. At the time, the Web Forms model was a breakthrough. Although in many ways the model was a black box, it definitely moved the state of web development forward.

In Web Forms, web pages are (normally) represented by two files, one with extension .aspx that defines the user interface, and another with extension aspx.cs or aspx.vb (depending on the server language, C# or VB.NET) that is used to write code to implement event handlers (e.g., button clicks, list-item selection, etc.) and other functionality.

ASP.NET Web Form is based on event driven approach which is similar to the functionality of windows applications where all the internal working is based on events. Event starts playing their role from the starting request accepted by server till page is rendered to the client. Page and every asp controls have their associated events which works in combination to render the dynamic web page.

On the other side , ASP.NET MVC is totally different from the ASP.NET Web Forms in terms of working. ASP.NET follow the MVC pattern for making the separation of concepts. It divided the whole functionality in three forms name Model-view-controller. Every request coming to the server from client is first handled by controllers as per the routing done. ASP.NET MVC works on the concepts of routing which is managed by routing engines. Every application is having its routing done for matching the requests and then responding accordingly. For every request done by client is first matched to the URL pattern provided in the routing in application and then it is handled by the corresponding controllers. After request is handled by controller, it calls the corresponding views available to it. Means Controller is having the vital role in handling the request and deciding whether call view or call model for performing some other processing like fetching records from database etc.

Further ASP.NET MVC is successful approach over ASP.NET Web Forms for making the application loose-coupled and helping programmer to go for unit testing with great ease.

SynapseIndia (CEO: Shamit Khemka)