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.
0
votes
0answers
3 views
How to stop chrome from caching REST response from WebApi?
I am using ASP.NET WebApi and have the following code to stop caching in everything:
public override System.Threading.Tasks.Task<HttpResponseMessage> ...
0
votes
0answers
17 views
How can I prevent File.Copy failing in Web API task code?
I have some Web API code that I've assembled from SO posts and other sites. However, the Task stuff is still new to me. I'm trying to copy an uploaded file to a new location, but sometimes (not all ...
0
votes
1answer
9 views
Cannot add ValueProviderFactory to Web API
I'm working with MVC 4 and I have this simple dummy ValueProvider:
class DummyValueProviderFactory : ValueProviderFactory
{
public override IValueProvider GetValueProvider(ControllerContext ...
0
votes
0answers
12 views
Restful web service GET request parameters
I'm using fiddler to test a Web API service I'm writing.
I know I can pass parameters to a RESTful web service in the querystring with a request like -
...
0
votes
1answer
12 views
Wrap XML Output on ASP.NET Web API
So I'm working on a web API that a Roku Channel will interact with to send and receive data. Roku SDK has a built in XML Parser that is easy to use, but the only problem is that Roku will only parse ...
0
votes
1answer
25 views
AngularJS passing Response as header/Web API
New to Angular but I am learning.
What my goal is: I have a login view that passes a user object to our API, API checks it against user database and reposnds with Base64 conversion of username and ...
1
vote
1answer
16 views
Knockout.js validation using extenders - prevent validation on load
I have implemented a very basic required validation on "first name" largely based on the example suggested on knockout website (http://knockoutjs.com/documentation/extenders.html) - Live example 2: ...
0
votes
1answer
24 views
return login success from a web api to an mvc 4 application
my colleague and myself are working on an application form with login functionality the user logs in from the mvc 4 app and there details are submitted to the web api to be checked against the values ...
-1
votes
1answer
30 views
Performance best practices [on hold]
I'm doing REST API on Azure Cloud Services with C#. And I need to serve many simultaneous requests.
What would be best practices on connecting to database, caching, etc?
Like, when do I need to ...
0
votes
0answers
24 views
MVC Web API POST request not working from client application but working from chrome Postman extension
I have a web API service with the controller as follows.
RoutePrefix("api/Product")]
public class ProductController : ApiController
{
[HttpPost]
[POST("InsertProduct")]
public ...
1
vote
1answer
21 views
What does JsonFormatter.MaxDepth do?
What does the MaxDepth property effect in the JsonMediaTypeFormatter? http://msdn.microsoft.com/en-us/library/system.net.http.formatting.jsonmediatypeformatter.maxdepth(v=vs.108).aspx
Changing this ...
4
votes
2answers
33 views
Multiple GET actions
I'm creating the following controller:
public FoosController : ApiController
{
public IQueryable Get()
{
return AnODataQueryableListOfFoos();
}
public void Delete(Guid id)
...
0
votes
0answers
16 views
Make the XmlMediaTypeFormatter use fallback characters when Encoding fails
So, I'm dealing with some pretty nasty legacy data, and I need pass some of it to a RESTful API.
I'm using WebApi Client (the nuget package), and I'm running into a problem: Sometimes, one of my ...
0
votes
1answer
24 views
AngularJS save() returns incorrect response from Web API
I have an angularJS site using a Web API backend. I am trying to do a save and I am expecting to get back a resulttype enum which is defined below
public enum ResultType
{
Success,
...
0
votes
0answers
27 views
Web-API, DelegatingHandler and security. Principal is reset in Controller
I've a DelegatingHandler in my Web-API service that, based on the headers provided, set a custom IPrincipal (ServicePrincipal) on the Thread.CurrentPrincipal and on the HttpContext.Current.User. This ...
7
votes
1answer
125 views
Entity Framework 4 issue
Using .NET Web API (.NET 4, EF 4) and I'm getting some strange errors when debugging and really can't figure what is going on.
Say in the DocumentRepository I have this constructor:
public ...
0
votes
2answers
34 views
Testing ASP.NET Web API File upload
I am trying to use N-UNIT to test my web API application but I am unable to find a proper way to test my file upload method. Which would be the best approach to test the method?
Web API Controller:
...
0
votes
1answer
18 views
Either OData or Code-First fails: derived navigation properties
I'm having a complex situation where I either get a problem with the Code-First portion of my project, or a problem with the OData portion of my project...
I have an abstract class Person of which ...
0
votes
2answers
20 views
Circular Reference error when serializing objects in ASP.NET Web API
I'm writing a Web API project in C# that uses Entity Framework to pull data from a DB, serialize it and send it to a client.
My project has 2 classes, Post and Comment (foreign key from Post).
These ...
2
votes
1answer
23 views
End User Style Testing of asp.net mvc web api
I am using this default project of asp.net web API . Now I want to create a BDD style End User testing .
I want to consume my web API as my real user will do in BDD way using specflow . I searched ...
0
votes
0answers
36 views
CORS POST Requests not working - OPTIONS (Bad Request) - The origin is not allowed
I'm having a lot of trouble getting a cross domain POST request to hit an Api controller in the latest beta 2 release.
Chrome (and other browsers) spit out:
OPTIONS ...
0
votes
1answer
29 views
Retrieve JSON ordered results array with no names from Asp.net MVC web api
I'm taking my first stab at Asp.Net Web API and MVC to retrieve JSON results. When I query the controller, I receive the following JSON set:
...
0
votes
0answers
23 views
Exception in ExceptionFilterAttribute is always of type HttpResponseException
Following this post on exception handling in the ASP.NET Web API, I created an ExceptionFilterAttribute that looks like this:
public class NotImplExceptionFilterAttribute : ExceptionFilterAttribute
{
...
1
vote
1answer
32 views
How do I make properties returned in ASP Web API configurable?
Several RESTful APIs give the caller options for the amount of data they have returned, often by a querystring parameter (eg stackexchange's filter parameter).
I'd like to at least provide some ...
-1
votes
1answer
28 views
Pivot json data from array of models
I host a web api service, which returns a snapshot of my model "myModel" for the last 12 months. The json array that I receive on my client is a simple array of 12 "myMydel" objects.
If myModel has ...
2
votes
2answers
43 views
Posting json to mvc 4 WebApi controller action. Why doesn't it deserialize my array?
The following has been driving me a bit crazy. I have found a couple of similar problems but they did not offer a solution. I am trying to post a json object containing a few data items. One of them ...
0
votes
1answer
37 views
KO Single page app. Async data calls randomly failing/not binding
I've got a single screen with multiple dropdowns. Each get populated via a web api call.
I'm in an active directory environment. I'm using the Durandal SPA framework.
At the moment I do the loading ...
0
votes
0answers
30 views
Invoking OData actions from C# client and parsing the response
I'm writing a server using ASP.Net WebAPI pre-release bits in VS2012 (I'm happy to use VS2013 although I don't think it will help at the moment).
In it I have a bunch of OData controllers exposing ...
0
votes
1answer
50 views
serialize to C# MVC model class from knockout Model
-----knock out js code------------
var User = function () {
this.UserName = ko.observable();
this.Password = ko.observable();
};
var LoginViewModel = function () {
var self = this;
...
0
votes
1answer
22 views
Consuming ASP.Net Web API from developer client workstation
I have developed a .Net Webapi which uses Entity Framework and all is functioning correctly using the uri... //mywebserver/webappfolder/api/mycontroller?val=1&val=2&val=3
The EF and API are ...
0
votes
1answer
27 views
How do I document an optional QueryString parameter in ASP.NET WebApi Help Pages?
The ASP.Net Web Api Help Pages seem to automatically determine if a parameter is in the Request Uri or Body. How can I document option parameters that are QueryString parameters?
For example I have ...
2
votes
1answer
44 views
Custom Json.NET serializer settings per type
I am using an ApiController which uses the global HttpConfiguration class to specify the JsonFormatter settings. I can globally set serialization settings as follows very easily:
...
0
votes
2answers
36 views
allow custom header in web api
I need to allow a custom header called "secretToken". And every call to my webapi, the user should pass this header.
I searched for a way to do that, but I could not found an easy way. How can I ...
1
vote
1answer
33 views
ModelState serialization
I am trying to implement custom validation in Web API. The code in Galloway's video on the subject seems to have changed. I did download the code and the way the create action filter is like this:
...
0
votes
1answer
41 views
asp.net webapi / jquery : loading an xml stream
I have an ASP.NET WebAPI method that returns a string containing a valid XML document:
public class MessageController : ApiController
{
private readonly MyContextProvider _contextProvider = new ...
0
votes
1answer
53 views
OWIN OnSendingHeaders Callback - Reading Response Body
This question is related to the excellent answer by Youssef. I love OnSendingHeaders callback. I can now add the response headers without worrying about switching streams. Anyways, here is my ...
0
votes
0answers
18 views
ASP.NET Web API Custom Role Provider GetRolesForUser Only Called Once
I am using a custom role provider with Web API. I use the Authorize attribute to specify which roles the user must have on each controller. I use Windows authentication, so the user doesn't need to ...
0
votes
1answer
21 views
Android request to a ASP.NET Web API
I'm trying to make a GET request to a ASP.NET Web API from Android. The API should return a JSON object with some users. When calling the API from the browser everything works fine, but when ...
1
vote
1answer
39 views
Removing References from Asp.Net Web Api Project
I'm creating a new asp.net web api project, and it will works just as an Rest API, there is no interfaces and web standards, just a rest service to serv from other front-end applications. When I ...
0
votes
1answer
11 views
breezejs: populate the error property of SaveResult
Currently when calling SaveChanges on the webapi controller, if a business rules is not satifisfied, we throw an exception with the error message.
It's bad practice and instead we should return with ...
1
vote
0answers
22 views
PATCHing entities in Web API
I was wondering how to use the PATCH HTTP verb on my application since sometimes I don't need to update the whole entity.
The problem, is that in C# the lack of value is represented by null (there is ...
1
vote
1answer
71 views
c# webapi httpget attribute
I am following this tutorial:
http://www.asp.net/web-api/overview/web-api-routing-and-actions/create-a-rest-api-with-attribute-routing
and looking at the "Get Book Details" section.
I see this ...
2
votes
1answer
37 views
MVC 4: Durandal bundling cache
My site is built on a WebAPI back end...
the issues occurs on deployment, as my Uri wasn't formatted correctly due to our IIS deployment/site structure
WRONG
http://itil.mysite.com/api/Building
...
0
votes
2answers
49 views
How I can use OData services with MVC4?
In my project CloudMiddleware a have services for integrations with API like, PayPal, Twilio, etc. I have endpoints for SOAP, REST and AJAX requests, I want to use ODATA flexibility also because ...
-2
votes
1answer
33 views
How to render the partial view after getting the data from the Web Api Controller [on hold]
I want to render the partial view after getting the data from the web api controller action.
I want to do the following operations:
Need to get the data from the web api controller using post method ...
0
votes
0answers
35 views
Ninject Transient Scope + Scope Disposal + Garbage Collection + Memory Leak
I am new at this (I'm still learning), I would appreciate very much if you Jedi masters out there can help me out with the question and concern that I have.
I want to use Ninject and I have the codes ...
0
votes
0answers
75 views
WEB-API OData $Batch fails after update to nightly build July 15
I've been using a nightly build from back in June up until today. I had written a Batch handler to parse my request, and it was working. After the update, my ParseBatchRequestsAsync is called once for ...
2
votes
1answer
34 views
JSON .Net generates schema incorrectly (type as an array)
When using the JSON.Net JsonSchemaGenerator to generate JSON Schema for my object:
Public Class Host
Public Property uid() As String
End Class
It generates the type property as an array of ...
0
votes
0answers
27 views
MongoDB C# driver and MVC4 webapi. Issue in json serialization
I am using MongoDB database with MVC4 WebAPI using the C# driver provided by MongoDB. I have a an issue with serialization. I get the following error,
"ExceptionMessage=Error getting value from ...
0
votes
1answer
39 views
Converting HttpRequestMessage to OwinRequest and OwinResponse to HttpResponseMessage
I have a web API message handler MyHandler that I want to run in OWIN pipeline as a middleware. So configuring the handler like this.
public class Startup
{
public void Configuration(IAppBuilder ...