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
0answers
6 views

Simple Injector Web Api Controller Constructor Injection Failing

My Web Api app is failing when trying to instantiate an injected controller. I'm using Simple Injector. Bootstrapping the injector is as follows: [assembly: ...
1
vote
0answers
11 views

Retrieving Action Signature Custom Attributes

Suppose I have an action method that looks like this: [return: Safe] public IEnumerable<string> Get([Safe] SomeData data) { return new string[] { "value1", "value2" }; } ...
0
votes
0answers
10 views

Property not found in web api

The Result property in actionExecutedContext.Result cannot be resolved. Any ideas why? Here's my code. using System.Collections.Generic; using System.Linq; using System.Net; using ...
0
votes
0answers
13 views

JSON not binding correctly in WebApi action

I'm creating and api using asp.net webapi For some reasons this json: JSON => {"page":"1","count":"10","sorting[name]":"asc"} JSONString = ...
0
votes
0answers
8 views

c# Web Api with CORS Enabled and the dreaded No 'Access-Control-Allow-Origin' header is present on the requested resource

I have a C# Web API project. I created a Controller using the Web API 2 standard. I am trying to enable CORS on only one action, this is what I have: namespace MyProject.Controllers { public ...
0
votes
1answer
9 views

Execute a simple call to a WebAPI Get using RestRequest and a single string parameter

I have the following code in my receiving controller: [Route("api/StudentUserId/{string}"), HttpGet] public StudentDto StudentUserId(string userId) { StudentModel sm = new ...
0
votes
0answers
11 views

in asp.net web api, is it possible to put the image data together with other fields in the get result

Suppose the model is like driver { lastname, firstname, byte[] picture } is it possible to return this model in the Get or Post method? I guess it's not because of the content type, but just want ...
1
vote
1answer
33 views

How do I extend IdentityRole using Web API 2 + AspNet Identity 2

I am attempting to extend the AspNet IdentityRole class provided in the Web API 2 (With Individual Accounts) template in the latest version of Visual Studio 2013. When I hit /api/roles it returns an ...
0
votes
1answer
9 views

Reading & Storing JSON data into observableArray

I have following Json returned from an web api {"PayHistories": [{"Id":3,"RateChangeDate":"2014-09-03T06:00:00","Rate":10.00,"PayFrequency":7,"JobTitle":"Production Manager","Gendre":"M"}], ...
1
vote
0answers
8 views

Social Network API design for Like, Comment, and other Interactions?

Suppose I have a website where I showcase people's artwork, recipes, and journals (and this list is likely to grow). I want people to be able to comment, like, flag, etc. all of them. I'm not looking ...
0
votes
0answers
3 views

How to mock dependencies for a WebApi 2 controller when using MEF 2 (System.Composition)?

With MEF (System.ComponentModel.Composition) it's possible to add mock objects to the container. container.ComposeExportedValue(mock.Object); ref: How to use Moq to satisfy a MEF import dependency ...
0
votes
2answers
20 views

Using WebSockets with ASP.NET Web API

What is the preferred method for using raw websockets in an ASP.NET Web API application? We'd like to use binary WebSockets on a couple of our interfaces of our ASP.NET Web API application. I'm ...
3
votes
0answers
21 views

Generate JSON Schema for ASP.Net Web API

I'm looking to generate JSON Schema for a WebAPI, including documentation from the XML comments. Its primarily so that I can then import that into our API docs (using apiary.io) I've managed to get a ...
0
votes
0answers
10 views

Additional information: Google.Apis.Requests.RequestError User cannot access account

An unhandled exception of type Google.GoogleApiException occurred in Google.Apis.dll Additional information: Google.Apis.Requests.RequestError User cannot access account string path ...
0
votes
1answer
18 views

Send complex DTO to web api using jquery ajax

I have a DTO Object like that: public class ImageDto : EntityDTO { public ImageDto() { Position = new PositionDTO(); Rotation = new RotationDTO(); Size = new ...
0
votes
0answers
20 views

AngularJS/MVC/WebApi Cookie and Token Auth

This is somewhat related to this question I asked. A new app I am starting will have the following structure - a very small ASP.NET MVC component which is a wrapper for the heart of the app which is ...
1
vote
1answer
15 views

Hardcoded Web API calls in code versus multiple environments

Actually, I hardcode my Web API calls like this : $http.get('my/production/web/api/method'); If I want to switch to a test environment, which is another Web API, I don't want to manually change ...
1
vote
0answers
15 views

Use External Access Token or Local Access Token

I am developing an application using ASP.NET MVC 5.2.2, Web API 2.2 and Katana/OWIN 3.0. The application uses ASP.NET Identity 2.1 for local accounts and database. I am using OAuth Authorization ...
1
vote
2answers
20 views

Disadvantages to Web Api methods returning Tasks

Why is the practice of returning a Task<T> from Web Api methods not the default and in the methods that you get when you create a new Web Api Controller in Visual Studio? Are there any ...
0
votes
1answer
50 views

At the same controller, GET and POST works, but PUT don't

I'm developing a Web Api 2 service with latest .NET Framework and C#. I have a controller with these methods: public IEnumerable<User> Get() { // ... } public User Get(int id) { // ...
0
votes
0answers
18 views

Retrieving additional profile information from Facebook during external login/register with ASP.NET Web API 2.0 and Identity

There appears to be a lot of documentation on how to get additional information from a Facebook profile using ASP.NET Identity and an MVC client, but I can't seem to find anything on how to access the ...
1
vote
0answers
22 views

How to configure number of TCP connections using dotnet (nugget package) httpclient?

I used to use HttpWebRequest.ServicePoint.ConnectionLimit (http://msdn.microsoft.com/en-us/library/system.net.servicepoint.connectionlimit(v=vs.110).aspx) to configure number of TCP connections opened ...
0
votes
0answers
7 views

ASP.NET Web API Security Token Generation Mechanism

I am using ASP.NET Web API to generate publicly accessible services that can be used by authenticated users. I am using token based authentication (OAuth Bearer tokens). ASP.NET has everything ...
0
votes
1answer
25 views

NHibernate SaveOrUpdate Repository does not Update but Save Data

I have two Controllers that call the same CommandHandler for SaveOrUpdate. One of the Controller is the normal MVC Controller while the other one is a WebAPI ApiController. Both works fine in Save ...
0
votes
0answers
7 views

Angular-tree-ui JSON Data with $http

I'm currently been using the angular-tree-ui component, which is a nice little component that allows nesting of hierarchical data with drag and drop support. All has been going well until I started ...
2
votes
2answers
55 views

How to pass bitArray from javascript to c#

I want to pass bitArray from my javascript file to my method in webApi I create bitArray as below in my javascript file var myBits = new BitArray(2); myBits.setAt(1,false); myBits.setAt(2,true); ...
0
votes
0answers
27 views

Uploaded 'multipart/form-data' to ASP.NET Web API action, not readable in bufferless mode

I'm building an ASP.NET Web API endpoint that accepts 'multipart/form-data' requests. I implemented it as described in this article using .NET Framework 4.5 and Web API 2.1. A simplified version of ...
0
votes
2answers
18 views

Web Api Rest method receives JObject wrapped in another JObject as a key value

I have problem with json which is sent from the sencha touch client to the rest web abi web service. When i send POST request from Sencha it looks like: var paramsData = Ext.encode({ ...
0
votes
1answer
23 views

ASP.NET Web API read model inside action filter

I have a special case when I need to get some data from request body (or model let say) inside action filter (AuthorizationFilterAttribute). I have found this way: public async override Task ...
0
votes
0answers
21 views

ASP MVC 5 WebAPI vs Ajax.ActionLink

I am having some difficulties understanding the difference between ASP.Net MVC WebAPI Controllers (System.Web.Http.ApiController) and @Ajax.ActionLink (PartialViews). As my knowledge of MVC 5 and ...
1
vote
0answers
24 views

curl sending null data on POST request to web api

I want to POST data through curl windows 64 bits onto a asp.net web api(using C#) . However every tim i do so, the control passes to the HttpPost method however the values of the accepting parameter ...
-4
votes
0answers
18 views

I need code in which describe how google content api for shopping works in c#.net in version2 [on hold]

I need code in which describe how google content api for shopping works in c#.net (version2). thanks in advance
0
votes
0answers
13 views

Sync API in .net

I have a relational DB with a few tables around 9-10 tables, i have to create a API to return all the Data from these tables to be synched into a device SQLLite db. Is it a good approach to go with ...
0
votes
1answer
8 views

web api tracing, library versions

My original problem was that I didn't get any xml response - only json - after changed to use XmlSerializer: var xml = GlobalConfiguration.Configuration.Formatters.XmlFormatter; xml.UseXmlSerializer ...
-2
votes
1answer
32 views

How to communicate with an web application to other web applications? [on hold]

I need information about how to communicate with an web application to other web applications using Asp.net MVC , Now i am working with job posting site(asp.net MVC application) . My exact criteria is ...
0
votes
0answers
14 views

WebApi 2.2 + Chrome = CORS 405 error

I have 2 projects setup: A Website that just uses HTML and durandal and calls a webapi post method using $.ajax. It's on localhost:33432 and calls the second site (note that the ajax call doesn't ...
0
votes
1answer
16 views

how to post plain text to ASP.NET Web API endpoint?

I have an ASP.NET Web API endpoint with controller action defined as follows : [HttpPost] public HttpResponseMessage Post([FromBody] object text) If my post request body contains plain text ( i.e. ...
0
votes
0answers
22 views

Deploy WebAPI alongside web site in IIS on port 80

I believe this might be a troublesome request but I want to give it due diligence because I didn't know how best to respond to the requester. We have an AngularJS client that is making a call ...
0
votes
0answers
22 views

Swagger UI setup in Web Api for endpoint and class documentation

I have a solution in VS2013 with several class libraries and a Web API project. I am running into a few problems when setting up Swagger UI. First, when I setup swashbuckle for my Web API project, I ...
1
vote
0answers
30 views

Add a navigation property to a plain object

So I have a viewmodel in my application that looks like: public class CountryVM { [Key] public int CountryID { get; set; } [ForeignKey("Country_CountryID")] ...
1
vote
0answers
32 views

Ajax calls with JSONP doesn't work. Callback not provided

I am trying to make a api call like this: var url = 'http://[api link]?callback=?'; $.ajax({ type: 'GET', url: url, async: true, xhrFields: { withCredentials: true }, ...
0
votes
0answers
16 views

How to produce ATOM formatted ODATA service with ASP.NET WebApi 2.2?

How can you produce ATOM formatted output in an ASP.NET WebApi 2.2 ODATA service? Creating the JSON version, or the simple XML format is easy. But no matter how I request the Content-Type, I always ...
0
votes
0answers
19 views

Binding json to web api action call

What is the proper way of binding a JSON to web api action parameter. For example, I have this JSON coming from browser client JSON {"model":[{"firstName":"Vivian","lastName":"Richards","game":0}, ...
1
vote
1answer
49 views

Reading every incoming request (URL) in ASP.NET WEB API

I was using ASP.NET MVC framework. In this framework, we checked every incoming request (url) for some key and assigned it to a property. We created a custom class which derived from Controller class ...
0
votes
1answer
33 views

How to list all possible routes in web.api host

I have to use a web.api host. Off course the spelling of the paths correctly is important, because if you make an error, you will soon end up with a 404 error. Is there a way, a simple call, or maybe ...
0
votes
0answers
21 views

How to create and download pdf in web api on ajax request from mvc

I want to create and download a pdf in web api. I am using two projects one for web api and other for mvc and i am sending ajax requests on web api from mvc project. I have searched but did not ...
0
votes
0answers
26 views

WebAPI and angular JS Excel file download - file corrupted

I'm generating an Excel file in my WebAPI. I "store" it in a memorystream and then put in the the response as follow : var result = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ...
0
votes
0answers
13 views

Configure WebAPI and MVC routes in One ASP.NET when the {controller} has the same name on both the API and MVC [duplicate]

I am setting up an MVC 5 site. In the same project, I setup a WebAPI scaffolding. For MVC, my routing looks like this: {controller}/{action}/{id} I want my API route to look like this: ...
1
vote
2answers
61 views

How to PATCH in Web API and OData

From reading the RFC specification of the Patch verb it's clear that the Patch verb shouldn't get values to partially update the entity but operations to make: ...With PATCH, however, the enclosed ...
0
votes
0answers
11 views

RESTful url - getting new subentity

There are 2 models: Entity and Subentity. Entity can have many connected Subentities (one:many relation). There is a method on server that returns new Subentity (let's call it GetEmptySubentity). ...