Skip to main content
Filter by
Sorted by
Tagged with
1218 votes
29 answers
994k views

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 ...
naspinski's user avatar
  • 34.8k
682 votes
18 answers
530k views

I recently found a movie organizer application which fetches its data from the IMDB database. Does IMDB provide an API for this, or any third party APIs available?
tusay's user avatar
  • 7,037
505 votes
11 answers
226k views

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 ...
LeftyX's user avatar
  • 35.6k
470 votes
15 answers
778k views

I have concerns on the way that we returns errors to client. Do we return error immediately by throwing HttpResponseException when we get an error: public void Post(Customer customer) { if (...
cuongle's user avatar
  • 75.5k
410 votes
9 answers
325k views

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. ...
VJAI's user avatar
  • 32.9k
374 votes
9 answers
243k views

I wish to add an ASP.NET Web API to an ASP.NET MVC 4 Web Application project, developed in Visual Studio 2012. Which steps must I perform to add a functioning Web API to the project? I'm aware that I ...
aknuds1's user avatar
  • 68.5k
372 votes
9 answers
259k views

I see in tons of examples on the web using the new HttpClient object (as part of the new Web API) that there should be HttpContent.ReadAsAsync<T> method. However, MSDN doesn't mention this ...
David Pfeffer's user avatar
360 votes
7 answers
443k views

I'm trying to support JWT bearer token (JSON Web Token) in my web API application and I'm getting lost. I see support for .NET Core and for OWIN applications. I'm currently hosting my application in ...
Amir Popovich's user avatar
348 votes
9 answers
334k views

I'm working on a web service using ASP.NET MVC's new WebAPI that will serve up binary files, mostly .cab and .exe files. The following controller method seems to work, meaning that it returns a file, ...
Josh Earl's user avatar
  • 18.4k
327 votes
16 answers
377k views

I am trying to call a web API from my web application. I am using .Net 4.5 and while writing the code I am getting the error HttpClient does not contain a definition PostAsJsonAsync method. Below is ...
Jidheesh Rajan's user avatar
304 votes
13 answers
318k views

I realize session and REST don't exactly go hand in hand but is it not possible to access session state using the new Web API? HttpContext.Current.Session is always null.
Mark's user avatar
  • 21.7k
280 votes
32 answers
292k views

Is there a way to display all enums as their string value in swagger instead of their int value? I want to be able to submit POST actions and put enums according to their string value without having ...
user avatar
275 votes
18 answers
244k views

I keep getting this error when I try to have 2 "Get" methods Multiple actions were found that match the request: webapi I been looking around at the other similar questions about this on stack but ...
chobo2's user avatar
  • 86.2k
264 votes
8 answers
158k views

Since Microsoft Web API isn't MVC, you cannot do something like this: var a = Request.MapPath("~"); nor this var b = Server.MapPath("~"); because these are under the System.Web namespace, not the ...
Zachary Scott's user avatar
251 votes
6 answers
319k views

I need to implement the following WebAPI method: /api/books?author=XXX&title=XXX&isbn=XXX&somethingelse=XXX&date=XXX All of the query string parameters can be null. That is, the ...
frapontillo's user avatar
  • 10.7k
234 votes
9 answers
357k views

Several months ago, Microsoft decided to change up the HttpResponseMessage class. Before, you could simply pass a data type into the constructor, and then return the message with that data, but not ...
praetor's user avatar
  • 3,315
226 votes
43 answers
441k views

Since upgrading to RC for WebAPI I'm having some real odd issue when calling POST on my WebAPI. I've even gone back to the basic version generated on new project. So: public void Post(string value) { ...
ianrathbone's user avatar
  • 2,362
224 votes
5 answers
640k views

I need to write the following data into a text file using JSON format in C#. The brackets are important for it to be valid JSON format. [ { "Id": 1, "SSN": 123, "Message": "whatever" ...
user1429595's user avatar
  • 2,785
218 votes
15 answers
223k views

The two entities are one-to-many relationship (built by code first fluent api). public class Parent { public Parent() { this.Children = new List<Child>(); } public int ...
Cheng Chen's user avatar
  • 43.7k
214 votes
9 answers
293k views

I am developing an API to expose some data using ASP.NET Web API. In one of the API, the client wants us to expose the date in yyyy-MM-dd format. I don't want to change the global settings (e.g. ...
Stay Foolish's user avatar
  • 3,776
210 votes
4 answers
249k views

Why are the FromBody and FromUri attributes needed in ASP.NET Web API`? What are the differences between using the attributes and not using them?
Rajneesh's user avatar
  • 2,109
205 votes
28 answers
437k views

I did the upgrade according to. http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2 I get the error. Does any one else got this ...
Michal Asaf Carmeli's user avatar
200 votes
14 answers
436k views

I have been using HttpClient for making WebApi calls using C#. Seems neat & fast way compared to WebClient. However I am stuck up while making Https calls. How can I make below code to make Https ...
Abhijeet's user avatar
  • 14.1k
195 votes
5 answers
228k views

I have a method that does a POST like below var response = await client.PostAsJsonAsync(url, entity); if (response.IsSuccessStatusCode) { // read the response as strongly typed object ...
govin's user avatar
  • 6,753
194 votes
14 answers
204k views

I'm using an MVC 4 web API and asp.net web forms 4.0 to build a rest API. It's working great: [HttpGet] public HttpResponseMessage Me(string hash) { HttpResponseMessage httpResponseMessage; ...
user1330271's user avatar
  • 2,691

1
2 3 4 5
759