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.

learn more… | top users | synonyms

1
vote
1answer
9 views

WebApi - Specify Content-Type in Uri

You can use AddUriPathExtensionMapping("json", "application/json"); To enable media type to be specified as part of the uri as seen below http://localhost/products.json How can I get WebApi to ...
0
votes
0answers
12 views

$resource POST specify foreign key

I have products data service myApp.factory('productsData', function ($resource) { return $resource('/api/Product/:id', { id: '@id' }, { update: { method: 'PUT' } }); }); Product is modeled as: ...
0
votes
0answers
19 views

MVC 4 Web API Authentication using Authorize attribute and WorldDomination plugin

I'm reasonably new to web development so please forgive me if my terminology is off a bit. I've created an MVC 4 Web API, and for certain methods on the API I'm needing a way to tell if a user is ...
0
votes
1answer
21 views

Log duration of an ASP Web API action

I am using an ActionFilter to log all action calls of my ASP.NET Web API project. The OnActionExecuted method tells a lot about what's been happening. I just can't figure out how to find an efficient ...
0
votes
0answers
46 views

Missing data when serializing object with JSON.Net

I am working on wrapping some existing code in an ASP.Net WebAPI controller. When serializing the object with JSON.Net the string returned is always empty (just empty {} ). The class that I am ...
0
votes
1answer
13 views

Breeze, OData, and no EF

I'm learning breeze nowadays and I want to ask about using breeze without EF. The BreezeController exposes IQueryable for all entities. When a breeze request comes,OData format is used for the query, ...
0
votes
0answers
20 views

Redirect URL gets rewritten on Azure

I have an APIController that needs to redirect to another service that may have a different subdomain. Simplified code: [HttpGet] public HttpResponseMessage DoSomething() { HttpResponseMessage ...
0
votes
1answer
26 views

.Net web api, SSL + basic auth

I have multiple sets of sensor networks that are sending data to a .net web api. Somehow, I need to secure some of the endpoints of the API (so that I can be certain that the information sent to the ...
0
votes
1answer
36 views

Uploading a large file from phone

I'm trying to write a WP8 app that needs to upload a large amount of data back to my server. My server runs on ASP.net and implements REST using WebAPI. I've gotten to a point where I can upload ...
0
votes
1answer
22 views

web api odata action method to return image

We are using asp.net web api odata entitysetcontroller to get user profiles. The url that represents a single user profile looks like this http://www.domain.com/api/org/staff(123) Now bussiness ...
0
votes
1answer
21 views

ASP.NET Web API Documentation duplicate entries

I'm trying to create documentation for my API's. So far I've tried with Swagger.Net and Web API help pages Both tools provided me with correct documentation which is generated from XML but both of ...
1
vote
0answers
54 views

WebApi modelBinding fails when property inherits from Dictionary<string, string>

WebApi model binding fails when a property in the viewmodel inherits from Dictionary<string, string>. The same model binding works when the data type of the property is changed to just ...
0
votes
1answer
30 views

How do I convert a Web API JSON response to a data table?

I have a web API where if I go to a valid link, it'll display an XML. However, in my other application, when I call: using (var webclient = new WebClient()) { var doc = ...
0
votes
1answer
42 views

Order property in System.Web.Http.AuthorizeAttribute

If I have multiple authorization attributes on an action, my understanding is that for System.Web.Mvc.AuthorizeAttribute I can specify the Order property like: [CustomAuth(Order=2)] ...
0
votes
1answer
17 views

AttributeRouting - how to specify route with query-string

I'm trying to add AttributeRouting to my WebAPI project. On one controller I currently have three GET methods defined: [GET("dictionaries")] public IEnumerable<Dictionary> Get() ...
0
votes
2answers
43 views

ASP.NET WebApi Post Method - 404 When Passing Parameters

I cannot for the life of me figure this out. I have a web api controller with Get and Post methods. The Get method works fine with and without parameters, but the post breaks when I try to add a ...
1
vote
1answer
22 views

Controller not filtering data in Breeze query in DotNetNuke Module

I am trying to include the basic Breeze sample in a DotNetNuke module (it works fine in a standalone WebAPI project). To simplify things I remove the client and will just refer to the URL JSON calls I ...
0
votes
1answer
20 views

Configure webapi in Windows Forms to accept CROS

I'm doing a project for college where one WebSite sends commands to a Windows Forms application. This application is Responsible for access to serial port and send and receive commands. Communication ...
0
votes
0answers
17 views

attributerouting limitations in webapi

In the documentation for attributerouting, there are a series of warnings that says that "performance enhancements when matching routes" does not work. What kind of performance enhancements are they ...
3
votes
1answer
55 views

Entity Framework limit properties returned by Include

I am using Include() to add related objects to query results. However, I don't want all the fields of the related table in the result set. I have managed to come up with the following solution, which ...
1
vote
2answers
57 views

Returning valid JSON from JSON Formatter on HTTP OK for WebAPI

I use WebAPI for various REST calls, and have always on success (when I don't need data) just used return new HttpResponseMessage(HttpStatusCode.OK); However with jQuery 1.9 having a breaking ...
0
votes
3answers
35 views

jQuery ajax call to WebApi works on IE but not Firefox, Chrome or Opera

I have a test web page for calling a WebApi URL and getting a reply. It works as expected in IE, but none of the other browsers. Here is the jQuery call I make $(document).ready(function() { ...
1
vote
1answer
17 views

web api odata with v3 filters any all not working with entity framework.

I am trying to use the new filters 'any' and 'all' with odata and entityframework. For ex: i want to find out the employees who has dotnet skills. so i have a skill model class with name as one of ...
0
votes
2answers
28 views

Append Application(Andriod/Iphone/Windows) version in HTTP Request?

I have ASP.NET server with client application available in Android,Iphone and Windows. I want to append the application version*(for example 2.1.2 my application version)* in HTTP request headers. ...
0
votes
2answers
39 views

How to create an endpoint that accepts any content type in the request body using ASP.Net Web API

I'd like to create a generic API endpoint that a client can post text or file data to, where we won't know the content/media type of the data. It seems the framework requires a content formatter to be ...
0
votes
1answer
20 views

Using simplemembership within ninject repository - via API & standard controller

I am building a fairly small sized mvc4 application. I want to use the simple membership provided as in time I can it being useful for the social stuff. I want to be able to take advantage of the ...
0
votes
1answer
22 views

Programmatic Access to Visual Basic Project is not trusted from IIS

I'm using an executable which tries to access the VBA object model programmatically by importing and running VBA macros in Word07. If I call that executable from command line everything works fine ...
1
vote
2answers
62 views

ASP.NET WebApi and Partial Responses

I have a ASP.NET WebApi project that I am working on. The boss would like the returns to support "partial response", meaning that though the data model might contain 50 fields, the client should be ...
2
votes
1answer
38 views

API path different from dev to test to prod. How do I avoid changing between deployments?

Using ASP.Net WebAPI and javascript/jquery. I have the following JScript code:var apiUrl = "/api/myService/myMethod/ $.GetJSON(apiUrl+"/"+myValue).done(function(data){more code here}); In my dev ...
0
votes
1answer
21 views

Out parameter in an HttpGet - ASP.NET Web API

Can you have an out parameter for an HttpGet in ASP.NET WebAPI? If so, what would the URI look like for this call? [HttpGet] public HttpResponseMessage Query(string mask, out List<Int> Ids)
1
vote
1answer
33 views

Only serialize List property when not empty

In web api, I'm serializing a class that contains properties that are IEnumerable and I only want the properties to be serialized if they are not empty collections. [DataMember(EmitDefaultValue = ...
0
votes
1answer
23 views

How to get ASP.Net Web API and OData to bind a string value as a key?

I'm going through a short Web Api + OData tutorial from asp.net: ...
0
votes
1answer
50 views

Input validation for .NET web api in Http Get request

I am developing a Restful service using .net web API. There are a few posts about input validation for the post request using model validation. However, I am wondering what is the best practice of ...
1
vote
2answers
31 views

DelegatingHandler setting CurrentPrincipal

I am trying to unit test an implementation of DelegateHandler. My simplified implementation: public class FooHandler : DelegatingHandler { protected override async ...
2
votes
1answer
30 views

Web.Api deserialization fail for model parameter with different name

I've got one method, which take a model [AccountLinkRequest] as a parameter with url-encoded data. It's uses Json.NET by default, and also, I can't use the setting UseDataContractJsonSerializer = true ...
0
votes
1answer
15 views

How to limit data in a mobile API using EF and WebAPI/JSON

I am writing a PhoneGap/Web/JS mobile application that uses the WebAPI and Entity Framework in the backend. I have a class called Thing which references the User table 4 times (ChangedByUserId, ...
0
votes
1answer
32 views

Cannot deserialize array of integers with WebAPI?

I'm sending the following : { "setIds": ["1", "2"], "folderIds": ["3", "4"], "filter": "FILTERED" }; To an API endpoint that accepts a SessionDto: [DataContract] public class ...
1
vote
1answer
27 views

ASP.NET Web API - How can I keep a session alive until after custom MediaTypeFormatter is complete?

I have an ASP.Net Web API project. I am using NHibernate in this project; Fluent NHibernate to be specific. I am handling NHib session management using a custom ActionFilterAttribute. It looks like ...
0
votes
0answers
33 views

504 Error in .NET Web API

We have a 4 servers that have the Web API installed on and are sitting behind a Network load balancer. When I use Fiddler to make a request to the NLB address, it fails with a: [Fiddler] ...
0
votes
1answer
23 views

GET request with data in body

I'm implementing an API endpoint that serves data but makes no modifications to data - it's something along the lines of "GET all items that match this list of filters", where a filter could be ...
0
votes
2answers
45 views

Passing constructor arguments to injected objects in the MVC controller

I am developing a MVC application using .net, I am using autofac as the IoC container. I have service class which needs a parameter in the constructor. And the parameter is resolved at run time from ...
0
votes
4answers
78 views

Internal error 500 on POST web api

I have a problem with my web api application. I get an internal error 500 when i try to post(save) a new user in my db. The function bellow is the one that i use to make the client call. public ...
1
vote
1answer
30 views

“Object reference not set to an instance of an object” when creating a new Web API controller with EF Scaffolding in Visual Studio 2012

I have an MVC4/Web API project, with an Entity Framework, Code First data model. When I try to create a new API Controller with read/write methods using a data context & model, I get an alert ...
0
votes
2answers
68 views

Calling ASP.NET Web Api method with PHP

I have the following web method in my web api controller public HttpResponseMessage PostMakeBooking(FacilityBookingRequest bookingRequest) { var returnStatus = HttpStatusCode.OK; ...
0
votes
1answer
76 views

Best practice for ASP.NET Web API design?

I'm currently trying to create a REST'ish web service backend with an ASP.NET Web API, EF5 Code First approach. Looking now for some advice to avoid the maybe most known novice errors. Whats the best ...
1
vote
1answer
56 views

Why aren't actions showing in WebApi Help Page

I have a WebApi project in Visual Studio 2012. I created it from the template and have since added in the HelpPage stuff through the use of NuGet. Below is my example. HierarchyController.cs public ...
0
votes
1answer
43 views

Getting a web application's URI during startup

I need to find out the base URI of an ASP.NET Web API application hosted in IIS 7.5+, right after the app's startup, but before any client request may have reached it. The scenario where I need this ...
1
vote
2answers
41 views

Deserialize a JavaScript object as Dictionary<string, string> via ModelBinding in Web API

I have a simple JavaScript string and object: var name = "Scarlett Johansson"; var args = { arg1: "foo", arg2: "bar" }; And I want to pass them via $.ajax to a Web API controller: public string ...
2
votes
1answer
35 views

Setting WWW-Authenticate response header within a DelegatingHandler causes havoc on w2k3

I am using a custom authentication mechanism by means of sending a session token. The presence of the token is checked in a DelegatingHandler which sets the current principal accordignly. If the ...
1
vote
1answer
23 views

How to set the EmitDefaultValue to false globally for all Data Members in Web API?

I'm using Web API and I've set the below property so that the default value is not displayed when members are serialized: [DataMember(EmitDefaultValue = false)] public string EventName { ...

1 2 3 4 5 75
15 30 50 per page