Click here to Skip to main content
15,936,903 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have experience of working on asp.net web forms only but now wants to switch learning asp.net mvc. I want to ask question regarding web API that Web API in mvc is consumed by your javascript code only( single page application javascript frameworks, jquery) ? Can we used it in way we work with wcf like creating proxies and then passing server side entities and response in server side objects ?

Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 7-Feb-15 10:26am    
How could it be "client side only" if ASP.NET itself is a server-side technology?
—SA
touseef4pk 7-Feb-15 11:53am    
I haven't said it is client side. What I want to ask is how will we use it in place of wcf where we generate proxies. What will do in this case ?

1 solution

You can use WebApi with any client: JavaScript, Android, iOS, Windows App, etc. Any platform that can consume a web service will support Web API. So yes, Web API can be used in place of WCF. It is also much easier to setup and consume.

You can also pass/return server-side domain objects. By default, WebAPI serializes and deserializes using JSON, but that is configurable.

This is an example of WebAPI being consumed on Android: http://hintdesk.com/how-to-call-asp-net-web-api-service-from-android/[^]
You can learn more about WebAPI here: http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api[^].
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900