SlideShare a Scribd company logo
S.No ASP.NET Web API

ASP.NET MVC

1

Purpose of ASP.NET MVC:
To create web applications that returns both
views and data.

Purpose of ASP.NET Web API:
To create full blown HTTP services with
easy and simple way that returns only data
not view.
i.e., ASP.NET Web API is focused on
making output of raw data easy.

i.e., ASP.NET MVC is focused on making
output of HTML easy.

In the WebForms world, ASP.NET MVC
In the WebForms world, ASP.NET Web API would be equivalent to .aspx pages.
would be equivalent to .asmx pages.
2

Default Assumption for ASP.NET Web
API:
ASP.NET Web API by default assumes that
primitive type comes from query string and
non-primitive types comes from the form. It
also assumes that we would only want to
read the form body once, without caching,
to have lower memory usage and better
performance.

Default Assumption for ASP.NET MVC:
ASP.NET MVC by default assumes user
submitted data can come from multiple
sources, be it in the query string or in the
form.

3

Whether it is possible to make ASP.NET
Web API output HTML ?
Yes

Whether it is possible to make ASP.NET
MVC output raw data ?
Yes

But, we need to do some additional work as But, we need to do some additional work as
provided below,
provided below,
Making additional classes to handle
text/html during content negotiation in
ASP.NET Web API.

Adding logic to handle OData queries in
ASP.NET MVC.

4

GET AJAX Request in ASP.NET Web
API:
ASP.NET Web API allows GET AJAX
request by default.

GET AJAX Request in ASP.NET MVC:
GET AJAX request is blocked by ASP.NET
MVC's JsonResult by default to prevent
CSRF.

5

Whether RESTful services can be created
with ASP.NET Web API ?
ASP.NET Web API helps the creation of
RESTful services over the .Net Framework.

Whether RESTful services can be created
with ASP.NET MVC ?
With ASP.NET MVC, we cannot able to
create RESTful services.

6

Return format of data:
ASP.NET Web API returns the data in
various formats, such as JSON, XML and
other format based on the accept header of
the request.

Return format of data:
ASP.NET MVC returns the data in the JSON
format by using JSONResult.

7

Request Mapping:
Request Mapping:
In ASP.NET Web API the request are
In ASP.NET MVC the request is mapped to
mapped to the actions based on HTTP verbs. actions name.

8

Where we can see the features such as:
model binding, filters, routing etc., in

Where we can see the features such as:
model binding, filters, routing etc., in
ASP.NET Web API ?
System.Web.Http
9

ASP.NET MVC?
System.Web.Mvc

Whether content negotiation and self
hosting features are supported ?
ASP.NET Web API supports content
negotiation, self hosting.

Whether content negotiation and self
hosting features are supported ?
ASP.NET MVC does not support content
negotiation and self hosting features.

Content Negatiotion – It is about deciding
the best response format data that could be
acceptable by the client. it could be
JSON,XML,ATOM or other formatted data
10

How routing is defined in ASP.NET Web
API?
Routing is defined by webapiconfig class
i.e., using MapHttpRoute method.

How routing is defined in ASP.NET MVC?
Routing is defined by routeconfig class i.e.,
using MapRoute method .

Unlike MVC, Routing API here does not
use any reference to MVC .
11

When to use ASP.NET Web API?
Web API is more capable of supporting
many different clients,namely, WPF Client,
iPhone, Android, iPad, Windows Phone 7,
Windows Phone 8, Web Browsers: IE,
Firefox, Chrome etc., then ASP.NET Web
API is likely going to be a better choice.

When to use ASP.NET MVC?
Asp.NET MVC is optimized for having a web
browser as a client.
If our only client is a web browser, then MVC
is likely going to be a better choice.

Note:
1.We can mix Web API and MVC controller in a single project to handle advanced AJAX requests
which may return data in JSON, XML or any others format and building a full blown HTTP service.
Typically, this will be called Web API self hosting.
2.When we have mixed MVC and Web API controller and you want to implement the authorization
then we have to create two filters one for MVC and another for Web API since boths are different.
Reference:
http://onlydifferencefaqs.blogspot.in/2014/02/difference-between-aspnet-web-api-and.html

More Related Content

What's hot (20)

PPT
CSS
Sunil OS
 
DOCX
Blood Bank Management System Project Proposal
Azmeen Gadit
 
PPTX
Online jobportal
teriwoja
 
PPSX
Html introduction
Dalia Elbadry
 
PDF
Web scraping in python
Viren Rajput
 
DOCX
Final project(news portal system).docx
DagimDejene
 
PPTX
Bootstrap PPT by Mukesh
Mukesh Kumar
 
PDF
Chat bot in_pythion
ShivendraPratapSingh84
 
PPTX
Bootstrap - Basics
FirosK2
 
PDF
Javascript basics
shreesenthil
 
DOC
Online blood bank management system
skk4646
 
PPTX
Complete Lecture on Css presentation
Salman Memon
 
PDF
project
dnraj
 
PPT
Request dispatching in servlet
vikram singh
 
PPTX
ASP, ASP.NET, JSP, COM/DCOM
Aashish Jain
 
PDF
Bootstrap
Jadson Santos
 
PPT
Php Presentation
Manish Bothra
 
PPTX
Rwd ppt
Suresh B
 
PPTX
presentation in html,css,javascript
FaysalAhammed5
 
PPTX
Blood bank mange project presentation
City University
 
CSS
Sunil OS
 
Blood Bank Management System Project Proposal
Azmeen Gadit
 
Online jobportal
teriwoja
 
Html introduction
Dalia Elbadry
 
Web scraping in python
Viren Rajput
 
Final project(news portal system).docx
DagimDejene
 
Bootstrap PPT by Mukesh
Mukesh Kumar
 
Chat bot in_pythion
ShivendraPratapSingh84
 
Bootstrap - Basics
FirosK2
 
Javascript basics
shreesenthil
 
Online blood bank management system
skk4646
 
Complete Lecture on Css presentation
Salman Memon
 
project
dnraj
 
Request dispatching in servlet
vikram singh
 
ASP, ASP.NET, JSP, COM/DCOM
Aashish Jain
 
Bootstrap
Jadson Santos
 
Php Presentation
Manish Bothra
 
Rwd ppt
Suresh B
 
presentation in html,css,javascript
FaysalAhammed5
 
Blood bank mange project presentation
City University
 

Similar to Difference between asp.net web api and asp.net mvc (20)

PDF
ASP.NET Web API Interview Questions By Scholarhat
Scholarhat
 
PPTX
C# web api
Simplilearn
 
PDF
Difference between asp.net mvc 3 and asp.net mvc 4
Umar Ali
 
PPTX
Web API with ASP.NET MVC by Software development company in india
iFour Institute - Sustainable Learning
 
PPTX
Asp.net web api
Binu Bhasuran
 
PPTX
Top 15-asp-dot-net-interview-questions-and-answers
sonia merchant
 
PPTX
Top 15 asp dot net interview questions and answers
Pooja Gaikwad
 
PDF
.NET Core, ASP.NET Core Course, Session 18
Amin Mesbahi
 
PDF
Intro To Asp
Adil Jafri
 
PDF
ASP.NET Core Interview Questions PDF By ScholarHat.pdf
Scholarhat
 
PPT
New Features Of ASP.Net 4 0
Dima Maleev
 
PPTX
ASP.NET Brief History
Sudhakar Sharma
 
PDF
Top 10 - ASP.NET Interview Questions And Answers 2023.pdf
Ruddarpratap
 
PPTX
ASP.NET Presentation
Rasel Khan
 
PPTX
JAVA SERVER PAGES
Kalpana T
 
PPT
Intro to asp.net
Information Technology
 
PPTX
Xml web services
Raghu nath
 
PDF
Complete guidance book of Asp.Net Web API
Shabista Imam
 
PDF
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
Evan Mullins
 
PPTX
Web API or WCF - An Architectural Comparison
Adnan Masood
 
ASP.NET Web API Interview Questions By Scholarhat
Scholarhat
 
C# web api
Simplilearn
 
Difference between asp.net mvc 3 and asp.net mvc 4
Umar Ali
 
Web API with ASP.NET MVC by Software development company in india
iFour Institute - Sustainable Learning
 
Asp.net web api
Binu Bhasuran
 
Top 15-asp-dot-net-interview-questions-and-answers
sonia merchant
 
Top 15 asp dot net interview questions and answers
Pooja Gaikwad
 
.NET Core, ASP.NET Core Course, Session 18
Amin Mesbahi
 
Intro To Asp
Adil Jafri
 
ASP.NET Core Interview Questions PDF By ScholarHat.pdf
Scholarhat
 
New Features Of ASP.Net 4 0
Dima Maleev
 
ASP.NET Brief History
Sudhakar Sharma
 
Top 10 - ASP.NET Interview Questions And Answers 2023.pdf
Ruddarpratap
 
ASP.NET Presentation
Rasel Khan
 
JAVA SERVER PAGES
Kalpana T
 
Intro to asp.net
Information Technology
 
Xml web services
Raghu nath
 
Complete guidance book of Asp.Net Web API
Shabista Imam
 
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
Evan Mullins
 
Web API or WCF - An Architectural Comparison
Adnan Masood
 
Ad

More from Umar Ali (20)

PDF
Difference between wcf and asp.net web api
Umar Ali
 
PDF
Difference between ActionResult() and ViewResult()
Umar Ali
 
PDF
Difference between asp.net web forms and asp.net mvc
Umar Ali
 
PDF
ASP.NET MVC difference between questions list 1
Umar Ali
 
ODT
Link checkers 1
Umar Ali
 
PDF
Affiliate Networks Sites-1
Umar Ali
 
PDF
Technical Video Training Sites- 1
Umar Ali
 
PDF
US News Sites- 1
Umar Ali
 
PDF
How to create user friendly file hosting link sites
Umar Ali
 
PDF
Weak hadiths in tamil
Umar Ali
 
PDF
Bulughul Maram in tamil
Umar Ali
 
PDF
Asp.net website usage and job trends
Umar Ali
 
PDF
Indian news sites- 1
Umar Ali
 
PDF
Photo sharing sites- 1
Umar Ali
 
PDF
File hosting search engines
Umar Ali
 
PDF
Ajax difference faqs compiled- 1
Umar Ali
 
PDF
ADO.NET difference faqs compiled- 1
Umar Ali
 
PDF
Dotnet differences compiled -1
Umar Ali
 
PDF
.NET Differences List
Umar Ali
 
PDF
Difference between ajax and silverlight
Umar Ali
 
Difference between wcf and asp.net web api
Umar Ali
 
Difference between ActionResult() and ViewResult()
Umar Ali
 
Difference between asp.net web forms and asp.net mvc
Umar Ali
 
ASP.NET MVC difference between questions list 1
Umar Ali
 
Link checkers 1
Umar Ali
 
Affiliate Networks Sites-1
Umar Ali
 
Technical Video Training Sites- 1
Umar Ali
 
US News Sites- 1
Umar Ali
 
How to create user friendly file hosting link sites
Umar Ali
 
Weak hadiths in tamil
Umar Ali
 
Bulughul Maram in tamil
Umar Ali
 
Asp.net website usage and job trends
Umar Ali
 
Indian news sites- 1
Umar Ali
 
Photo sharing sites- 1
Umar Ali
 
File hosting search engines
Umar Ali
 
Ajax difference faqs compiled- 1
Umar Ali
 
ADO.NET difference faqs compiled- 1
Umar Ali
 
Dotnet differences compiled -1
Umar Ali
 
.NET Differences List
Umar Ali
 
Difference between ajax and silverlight
Umar Ali
 
Ad

Recently uploaded (20)

PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 

Difference between asp.net web api and asp.net mvc

  • 1. S.No ASP.NET Web API ASP.NET MVC 1 Purpose of ASP.NET MVC: To create web applications that returns both views and data. Purpose of ASP.NET Web API: To create full blown HTTP services with easy and simple way that returns only data not view. i.e., ASP.NET Web API is focused on making output of raw data easy. i.e., ASP.NET MVC is focused on making output of HTML easy. In the WebForms world, ASP.NET MVC In the WebForms world, ASP.NET Web API would be equivalent to .aspx pages. would be equivalent to .asmx pages. 2 Default Assumption for ASP.NET Web API: ASP.NET Web API by default assumes that primitive type comes from query string and non-primitive types comes from the form. It also assumes that we would only want to read the form body once, without caching, to have lower memory usage and better performance. Default Assumption for ASP.NET MVC: ASP.NET MVC by default assumes user submitted data can come from multiple sources, be it in the query string or in the form. 3 Whether it is possible to make ASP.NET Web API output HTML ? Yes Whether it is possible to make ASP.NET MVC output raw data ? Yes But, we need to do some additional work as But, we need to do some additional work as provided below, provided below, Making additional classes to handle text/html during content negotiation in ASP.NET Web API. Adding logic to handle OData queries in ASP.NET MVC. 4 GET AJAX Request in ASP.NET Web API: ASP.NET Web API allows GET AJAX request by default. GET AJAX Request in ASP.NET MVC: GET AJAX request is blocked by ASP.NET MVC's JsonResult by default to prevent CSRF. 5 Whether RESTful services can be created with ASP.NET Web API ? ASP.NET Web API helps the creation of RESTful services over the .Net Framework. Whether RESTful services can be created with ASP.NET MVC ? With ASP.NET MVC, we cannot able to create RESTful services. 6 Return format of data: ASP.NET Web API returns the data in various formats, such as JSON, XML and other format based on the accept header of the request. Return format of data: ASP.NET MVC returns the data in the JSON format by using JSONResult. 7 Request Mapping: Request Mapping: In ASP.NET Web API the request are In ASP.NET MVC the request is mapped to mapped to the actions based on HTTP verbs. actions name. 8 Where we can see the features such as: model binding, filters, routing etc., in Where we can see the features such as: model binding, filters, routing etc., in
  • 2. ASP.NET Web API ? System.Web.Http 9 ASP.NET MVC? System.Web.Mvc Whether content negotiation and self hosting features are supported ? ASP.NET Web API supports content negotiation, self hosting. Whether content negotiation and self hosting features are supported ? ASP.NET MVC does not support content negotiation and self hosting features. Content Negatiotion – It is about deciding the best response format data that could be acceptable by the client. it could be JSON,XML,ATOM or other formatted data 10 How routing is defined in ASP.NET Web API? Routing is defined by webapiconfig class i.e., using MapHttpRoute method. How routing is defined in ASP.NET MVC? Routing is defined by routeconfig class i.e., using MapRoute method . Unlike MVC, Routing API here does not use any reference to MVC . 11 When to use ASP.NET Web API? Web API is more capable of supporting many different clients,namely, WPF Client, iPhone, Android, iPad, Windows Phone 7, Windows Phone 8, Web Browsers: IE, Firefox, Chrome etc., then ASP.NET Web API is likely going to be a better choice. When to use ASP.NET MVC? Asp.NET MVC is optimized for having a web browser as a client. If our only client is a web browser, then MVC is likely going to be a better choice. Note: 1.We can mix Web API and MVC controller in a single project to handle advanced AJAX requests which may return data in JSON, XML or any others format and building a full blown HTTP service. Typically, this will be called Web API self hosting. 2.When we have mixed MVC and Web API controller and you want to implement the authorization then we have to create two filters one for MVC and another for Web API since boths are different. Reference: http://onlydifferencefaqs.blogspot.in/2014/02/difference-between-aspnet-web-api-and.html