Asp.Net
Difference between WCF and Web API
What is WCF? WCF stands for Windows Communication Foundation. It is used to create a distributed and...
ASP.NET MVC is an open source web development framework from Microsoft that provides a Model View Controller architecture. ASP.net MVC offers an alternative to ASP.net web forms for building web applications. It is a part of the .Net platform for building, deploying and running web apps. You can develop web apps and website with the help of HTML, CSS, jQuery, Javascript, etc.
Learn MVC with this ASP.NET MVC tutorial which covers all the basic concepts of MVC for beginners:
Although web forms were very successful, Microsoft thought of developing ASP.net MVC. The main issue with ASP.net webForms is performance.
In a web application, there are four main aspects which define performance:-
ASP.net MVC excels on the above parameters.
ASP.NET MVC1
ASP.NET MVC2
ASP.NET MVC3
ASP.NET MVC4
ASP.NET MVC5
Here are a few useful things in this ASP.NET MVC tutorial which you need to remember for creating MVC application:
MVC is a software architecture pattern which follows the separation of concerns method. In this model .Net applications are divided into three interconnected parts which are called Model, View, and Controller.
The goal of the MVC pattern is that each of these parts can be developed, tested in relative isolation and also combined to create a very robust application.
Let see all of them in detail:
Model objects are parts of the application which implement the logic for the application's data domain. It retrieves and stores model state in a database. For example, product object might retrieve information from a database, operate on it. Then write information back to products table in the SQL server.
Views are the components which are used to display the application's user interface (UI) also called viewmodel in MVC. It displays the .Net MVC application's which is created from the model data.
The common example would be an edit view of an Item table. It displays text boxes, pop-ups and checks boxes based on the current state of products & object.
Controllers handle user interaction, work with the model, and select a view to render that display Ul. In a .Net MVC app, the view only displays information, the controller manages and responds to user input & interaction using action filters in MVC.
For example, the controller manages query-string values and passes those values to the model.
| Parameters | WebFroms | MVC |
|---|---|---|
| Model | Asp.Net Web Forms follow event-driven development model. | Asp.Net MVC uses MVC pattern based development model. |
| Used Since | Been around since 2002 | It was first released in 2009 |
| Support for View state | Asp.Net Web Form supports view state for state management at the client side. | .Net MVC doesn't support view state. |
| URL type | Asp.Net Web Form has file-based URLs. It means file name exists in the URLs and they must exist physically. | Asp.Net MVC has route-based URLs that means URLs which are redirected to controllers and actions. |
| Syntax | Asp.Net MVC follows Web Forms Syntax. | Asp.Net MVC follow the customizable syntax. |
| View type | Web Form, views are tightly coupled to Code behind(ASPX-CS), i.e., logic. | MVC, Views, and logic are always kept separately. |
| Consistent look and feels | It has master pages for a consistent look. | Asp.Net MVC has layouts for a consistent look. |
| Code Reusability | Web Form offers User Controls for code re-usability. | Asp.Net MVC has offered partial views for code re-usability. |
| Control for HTML | Less control over rendered HTML. | Full control over HTML |
| State management | Automatic state management of controls. | Manual state management. |
| TDD support | Weak or custom TDD required. | Encourages and includes TDD! |
What is WCF? WCF stands for Windows Communication Foundation. It is used to create a distributed and...
In ASP.Net, it is possible to create re-usable code. The re-usable code can be used in many places...
In this tutorial, you will learn- Adding ASP.Net Controls to Web Forms Label Control Textbox List...
Accessing Data from a database is an important aspect of any programming language. It is necessary for any...
In any application, errors are bound to occur during the development process. It is important to...
Let's look at an example of how we can implement a simple "hello world" application. For this, we...