There are many differences between MVC and Web API, including:
- We can use the MVC for developing the Web application that return both data and views but the Web API is used for generating the HTTP services that returns only data.
- The Web API returns the data in various formats, such as JSON, XML and other format based on the accept header of the request.
- But the MVC returns the data in the JSON format by using JSONResult.
- The Web API includes the various features of the MVC, such as routing, model binding but these features are different and are defined in the “System.Web.Http” assembly.
- And the MVC features are defined in the ” System.Web.Mvc” assembly.
- The Web API helps the creation of RESTful services over the .Net Framework but the MVC does not support.
- In Web API the request is mapped to the actions based on HTTP verbs but in MVC it is mapped to actions name.
- Asp.Net Web API is a new framework and part of the core ASP.NET framework.
- Web API is lightweight architecture and except the web application, it can also be used with smartphone apps.
- It supports convention based crud actions whereas mvc does not support this.
- We can manage the state of data in ASP.NET MVC and but we cannot do this in ASP.NET WEB API.
- Because REST by design is stateless.
- By Adding session to Web API you are making it stateful and defeating any purpose of having a REST FULL API.
Click Below Link to Download Notes Of This Blog
No responses yet