When developers start learning ASP.NET MVC they always compare ASP.NET with ASP.NET MVC. Comparison is always good in evaluating product in difference versions or between the two flavors of products. In this case there are differences, even though ASP.NET MVC is built on top of ASP.NET.
MVC is using ASP.NET runtime framework and some core features and classes but not everything. The programming style is completely different. Using this article I am trying to show you the main differences that are helpful for you two evaluate the two products.
There is lot of differences between them and ASP.NET has more advantages than MVC. This article is not to discourage MVC, it has real advantages, if designed properly and used in right application. The architectural differences are the advantages of the MVC framwork.
|You need .NET framework to install ASP.NET.||You need .NET framework & ASP.NET to Install MVC.|
|Supports Code behind page coding & Inline coding||Supports both Code behind page coding & Inline coding but, we should not use code behind as a practice because view should not perform any logic.|
|Pages are called Pages||Pages are called Views|
|There is a Life cycle for every page.||There is tailored lifecycle of the page. By default you won't see the events when you create the Views but, you can add the Page Load event by in a script server tag. Again its not a good practice|
|Page supports PostBack||View doesn't support Postback|
|We use Viewstate concept extensively||There is no Viewstate for view. There is no state of the controls. But state of the entire page can be maintained by a feature ModelBinders|
|Every Page is inherited from System.Web.UI.ViewPage||Every Page is inherited from System.Web.Mvc.ViewPage. View page is inherited from System.Web.UI.Page.|
|You don't have the strongly typed pages||You can create the Strongly typed Views using generics. It means, you can pass the object (Model) to the view page from the controller.|
|Has lot of inbuilt Controls that support RAD.||We cannot use the ASP.NET controls because they don't support the ViewState and Postback. |
We have inbuilt methods called HTML Helper methods. These methods just create the required HTML in the response stream. You can create the user controls.
|Has the limited control over the HTML being generated by various controls.||Since we have no controls and are writing HTML we have control over the markup.|
|Logic is not completely modularized in pages.||Logic is modularized in methods called Action methods of the controller.|
|Difficult to test the UI Logic using unit tests.||MVC is designed to unit test every part of the application. It strongly supports the TDD approach.|
|Doesn't support clean or search engine friendly URL's . ASP.NET 4 has the routing module or else |
we need to use URL rewrites.
|Support clean or search engine friendly URL's|
You can design to support the REST based resources in application.
|Code behind supports only one aspect of separation of concerns.||Mainly designed for Separation of Concerns.|
|Web requests are reached directly to the intended page. Web users can identify the pages on the server.||Web request finally will reach the controller. Requests never reach Views. Web user cannot identify a specific view on the server.|
|If you rename the web pages the URL is changed||You don't need to change the URL, even if you change the Controller and the View.|
|URLS are determined by the folder structure of the pages||You have to define the URL formats which are called Routes. Framework will try to match the URL with all the defined routes in an order.|
Framework will hand over the request to the corresponding route Handler.
|Query string are used as small inputs to the pages||URLS formats drive the inputs to the requests. You can also have querystrings|
|Related Pages are separated by folder||Related Views are written under controller. And for each controller we need to create a folder for all its views.|
|We have ASP.NET AJAX Framework and AJAX server side controls to support AJAX page development||MVC has some AJAX features but internally it uses the ASP.NET AJAX script libraries. So we have to manually include the libraries in the project. No support of AJAX Server side controls.|
|File extensions in IIS are mapped to ASP.NET isapi dll and in web.config they are mapped to corresponding file HTTPHandlers.||There are no file extensions for MVC. If deployed in IIS7 Internally it will use the MVC UrlRoutingModule to route the request to the MVC framework.|
|All the Page requests are handled by PageFactory Handler.||Each Route has the option to use a default Route handler or custom handler. So all the page requests are handled by Route handles.|
|It's difficult to modify the internal behavior of the core ASP.NET components.||It's designed to modify or replace the internal components. It supports the Plug-in structure|
Example: - ASPX Pages are used to render the HTML. You can configure to not to use ASP.NET pages and use different view engines.
There are many view engines available in market or you can create your own view engine.
To learn more on ASP.NET MVC, please go through my other post http://mstechkb.blogspot.com/2010/10/aspnet-mvc-presentaion.html