ASP.NET Web API is a framework for building HTTP services for clients like browsers and mobile devices. It is based on the Microsoft .NET Framework and ideal choice for building RESTful services.
153
votes
1answer
22k views
ServiceStack vs ASP.Net Web API
I am wanting to write a new REST style API and have looked at ServiceStack and quite like it. However, I have seen that Microsoft has released the ASP.Net Web API project as part of the new MVC 4 ...
124
votes
11answers
54k views
How do I get ASP.NET Web API to return JSON instead of XML using Chrome?
Using the newer ASP.NET Web API, in Chrome I am seeing XML - how can I change it to request JSON so I can view it in the browser? I do believe it is just part of the request headers, am I correct in ...
75
votes
4answers
21k views
How to secure an ASP.NET Web API
I'm wanting to build a RESTful web service using ASP.NET Web API that third-party developers will use to access my application's data.
I've read quite a lot about OAuth and it seems to be the ...
71
votes
10answers
18k views
JSONP with ASP.NET Web API
I am working on creating a new set of services in ASP.MVC MVC 4 using the Web API. So far, it's great. I have created the service and gotten it to work, and now I am trying to consume it using ...
61
votes
2answers
13k views
ASP.NET Web API Authentication
I'm really depressed by googling a lot on Web API authentication. I need to know how to authenticate a user from a client application while using ASP.NET Web API. I have seen all the videos on its ...
58
votes
3answers
16k views
Difference between ApiController and Controller in ASP.NET MVC
I've been playing around with ASP.NET MVC 4 beta and I see two types of controllers now: ApiController and Controller.
I'm little confused at what situations I can choose a particular controller.
...
50
votes
4answers
13k views
WCF vs ASP.NET Web API
I've spent a few months trying to grasp the concepts behind WCF and recently I've developed my first WCF service application.
I've struggled quite a bit to understand all the settings in the config ...
45
votes
2answers
1k views
How could I make my RavenDB application execute properly when UseEmbeddedHttpServer is set to true using 2-tier architecture?
I used RavenDB-Embedded 2.0.2230 in my application interacted with ASP .Net Web API in different assemblies.
When I set UseEmbeddedHttpServer = true on the document store, first time I send a request ...
41
votes
4answers
16k views
Mvc 4 vs. Wcf Web Api
What are the pros and cons of using each technology?
WCF Web Api is now merged into Asp.net
Asp.net web api now supports self hosting.
I still imagine if I want to expose multiple protocol schemas ...
38
votes
4answers
12k views
Cross platform authentication using ASP.NET Web API
How do I even begin coding authentication using ASP.NET Web API so it is cross-platform to support desktop, mobile and web? I'd read of some methods of doing RESTful authentication, such as using ...
35
votes
6answers
17k views
Cannot Inject Dependencies into ASP.NET Web API Controller using Unity
Has anyone had any success running using an IOC container to inject dependencies into asp.net ASP.NET Web API controllers? I cannot seem to get it to work.
This is what I'm doing now.
In my ...
35
votes
4answers
15k views
Multiple HttpPost method in MVC4 Web API Controller
I am starting to use MVC4 Web API project, I have controller with multiple HttpPost methods. The Controller looks like the following:
Controller
public class VTRoutingController : ApiController
...
33
votes
2answers
11k views
How to create ASP.NET Web API Url?
In ASP.NET MVC, we have @Url.Action for actions. Is there something similar like @Url.Api which would route to /api/controller?
29
votes
5answers
8k views
ASP.NET Web API: throw HttpResponseException or return Request.CreateErrorResponse?
After reviewing an article Exception Handling in ASP.NET Web API I am a bit confused as to when to throw an exception vs return error response. I am also left wandering whether it is possible to ...
28
votes
7answers
16k views
Single controller with multiple GET methods in ASP.NET Web API
In WCF Web API I had a class of similar structure:
public class SomeController : ApiController
{
[WebGet(UriTemplate = "{itemSource}/Items")]
public SomeValue GetItems(CustomParam parameter) ...