12
votes
3answers
4k views

WebAPI Controller is not being reached on DELETE command

I am having difficulty getting the DELETE Method on my Controller to fire when submitting the request over ASP.NET Web API. It returns a 404 but I cannot figure out why. The GET & POST requests ...
3
votes
2answers
516 views

ASP.NET Web API Authentication Options

What options are available for authentication of an MVC3 Web API application that is to be consumed by a JQuery app from another domain? Here are the constraints/things I've tried so far:- I don't ...
2
votes
1answer
7k views

Error :Request header field Content-Type is not allowed by Access-Control-Allow-Headers

I created an mvc4 web api project using vS2012. I used following tutorial to solve the Cross-Origin Resource Sharing, ...
2
votes
4answers
2k views

Sending JSON object to Web API

I am trying to figure out how I can send some information from a form to a Web API action. This is the jQuery/AJAX I'm trying to use: var source = { 'ID': 0, 'ProductID': ...
2
votes
3answers
741 views

XDomainRequest json POST body not being deserialized on ASP.NET Web API calls

As part of a solution to implement cross-browser, cross-domain support for an MVC4 web application making ajax calls to an MVC4 web api application, I'm using the XDomainRequest object to provide ...
2
votes
2answers
218 views

AJAX request fails when headers are set but succeeds without them

I have an ASP.NET Web API application running on my local instance of IIS. The web application is configured with CORS. The Web API method I am calling reads something like: ...
1
vote
1answer
942 views

MVC 4 (RC) Web Api OData not sorting properly

Recently updated to the RC of MVC4. It fixed a lot of problems, especially around date serialization. However, I'm having another problem. The OData sorting and options I was using for ...
1
vote
2answers
1k views

Forms authentication fails in MVC4 Web API using JQuery AJAX

apologies for the n00b question, but I've found information sporadic on this one. I've been making an API using MVC Web API and have been using forms authentication as described in the SO selected ...
1
vote
2answers
253 views

MVC4 not binding a list of basic types

I cannot, for the life of me, get this data to bind. Here's my JavaScript: var params = { 'InvItemIDs': ["188475", "188490"]}; $.post("api/Orders/OrderFromInventory?" + $.param(params)) and the ...
1
vote
1answer
178 views

janrain engage modal popup window wont close during the onProviderLoginToken event

Its been a long strange trip in my travels to get this entire process of authenticating the user using the Janrain client authentication process to work but I finally got it working but.... How do I ...
1
vote
1answer
130 views

Required annotation for webapi mvc4 fails for an integer property but works for string

When I make an ajax call, it fails with 500 Internal server error Value-typed properties marked as [Required] must also be marked with [DataMember(IsRequired=true)] The problem is with CallerID ...
1
vote
2answers
755 views

Customizing Header of a Web API Requests via JQuery/JavaScript (AJAX) or WinForms

I am learning and using Web API and need to implement following Authentication mechanism: Very First call to Web API will be a Handshaking (Login and token sharing). Login Method of the Web API ...
1
vote
2answers
135 views

Issues while making a POST to a Web API from JQuery

I have a web api with the following POST Method public HttpResponseMessage Post([FromBody]string package) I have a console app that uses the HttpCLient with no problems. When I try to make a call ...
1
vote
1answer
225 views

Parameters not passing through to MVC Controller with Guid ID

I have the following controller action using the web api on a .net 4.0 web forms web application. public dynamic Post(Guid id, string adminNotes = "", string artNotes = "") { ...
1
vote
2answers
103 views

Post fails from android using webApi

I am creating a simple android app that sends the name and phonenumber using POST in a JSON format to a webApi MVC4 in asp.net and using SQL server for the database. The problem is I can't seem to get ...
0
votes
2answers
1k views

How to return Json object on Web API Controller

I used this below code on my asp.net controller to return Json object on my Ajax on javascript public JsonResult myMethod() { // return a Json Object, you could define a new class ...
0
votes
2answers
1k views

How to use receive POST data in asp.net web api?

I've googled a whole day but still can't find the answer. I need to POST data via jQuery.post to Web API MVC-4 but unable to. This is my routing: routes.MapRoute( name: "Default", url: ...
0
votes
2answers
35 views

Rreading asp.net web api

I am working with a web api which returns product lists and price. The product list is displayed on page using Ajax. The prices gets updates regularly. The only way i know how to tackle problem is ...
0
votes
1answer
270 views

Breeze does not expand a navigation property

I have a Breeze dataservice (aka datacontext) in my Single Page Application. I want to get a list of Runs from a WebAPI controller along with a list of OutlineItems for each run. The controller is ...
0
votes
2answers
223 views

How could i pass parameters to method in a controller through jquery ajax calls

I am working on asp.net web api. I am trying to make a call to controller(Security) using jquery ajax calls. I have a method in my controller with 3 parameters like, public WebRequest ...
0
votes
2answers
49 views

Why $.ajax() 'error' function is invoked when the response status is 200/OK?

I am trying to 'GET' data from my WebAPI using JQuery $.ajax(). Here is my code: $.ajax({ type: "GET", url: ...
0
votes
1answer
168 views

Parse ASP Web API JSON Result: DateTime

I am using jQuery ajax to call a Web API service. The response is Json something like this ...
0
votes
3answers
506 views

ASP.NET Web Api CRUD operation in VS 2010 web application

I tried to make ASP.NET Web Api CRUD operation in VS 2010 web application, but why the result is not returning all entire row from source table. This is my code : Route/Globax.asax protected void ...
0
votes
1answer
359 views

Web API Form Data Collection

I'm trying to post form serialized values to controller (Web API Self Host). I cannot understand why the NameValueCollection is not correctly bound. Client-side using jQuery: // Form Submit Handler ...
0
votes
1answer
104 views

unable to post the data with bool value in asp.net web api

I am working on asp.net mvc webapi with EF code first with existing database. I have a class like, public class User { public bool IsAgree{get; set;} } Iam using MySql database, my table looks ...
0
votes
2answers
42 views

undefined error from second index when iterating over json list

My code runs as, $.ajax({ url: "api/WepAPI/", dataType: 'json', success: function (result) { alert(result.length); ...
0
votes
1answer
694 views

ASP.Net WebAPI Delete verb not working

I'm using IIS 7.5 with asp.net webapi to do a delete for a record id. I can get it to work in Safari, but not Firefox. Here's an image of the request/response for the jQuery Ajax submission: ...
0
votes
1answer
172 views

WebAPI Not Serializing

I am currently working through Pluralsight training for WebAPI and am running into some issues (downloading the examples didn't help as they don't work either - the course was created off of the Beta ...
0
votes
2answers
352 views

Access Control Services via IHttpModule with mvc 4 and and web api, different security settings for site and service?

I am building an mvc 4 web api project on Azure. Requests to this API go through the route: routes.MapHttpRoute( name: "DefaultApi", // Route name routeTemplate: ...
0
votes
1answer
59 views

why returned json contains an 'object' tag

My ApiController is public List<FileModel> Get(string foldername) on the client side, function ListFiles(folder) { $.ajax({ url: "/api/Files", data: "foldername=" + ...
0
votes
1answer
44 views

Why I got my model attributes null during a put request in web api?

I send a PUT request from my View to web API controller using JQuery and Ajax. It hit my web api controller but my model attributes are null. Here Is my Controller Code: public HttpResponseMessage ...
0
votes
1answer
154 views

cross domain ajax POST to web-api always return empty response

I want to POST HTML form to web-api. If I execute ajax POST with jQuery in other domain everything is OK and I receive 200 OK but in firebug and response tab I receive blank response like below ...
0
votes
3answers
129 views

Call WebAPI method passing string id argument

I have an ASP.NET MVC4 WebAPI implementation in which I have a method to check if the username is available while signing up. When the user leaves the user name text box, an ajax call call will be ...
0
votes
0answers
150 views

C# ajax Convert Transparent PNG to another file format with Non-Black Background Color

I have used the following resources from stackoverflow: C#: Convert Transparent PNG to JPG with Non-Black Background Color This returns an image with a black background Sample code // data was a ...
0
votes
0answers
138 views

API call my ajax success function never get called

I am trying to make an api call using &.ajax, when I use jsonp property outside my project folder the success function never get called but if I make the call directly from my project folder ...
0
votes
0answers
169 views

How to test MVC4 website and MVC4 webapi projects on local computer? [closed]

I have two projects on my development computer MVC4 WebApi project and MVC4 Website project The website makes calls to the API from client-side JavaScript using jQuery .ajax(). var request = ...
0
votes
1answer
359 views

Using Ajax/jsonp to receive data from Web Api

I've built a simple web service using the Web Api and I want to consume it from a simple mVC view using jQuery. I'm developing on localhost and consuming the service from Azure, which is why I'm using ...
0
votes
1answer
174 views

Knockout.js foreach with MS WebAPI

defining two FOREACHs in two different DIVs as follow <div style="background-color:black; color:white; overflow:scroll; height:350px;width:300px"> <ol data-bind="foreach: price_quantity"> ...
0
votes
1answer
277 views

HTTP Put is not working for me in MVC 4 Web API. I keep getting a 404

var assetimage_id = $(this).closest(".assetImageWrapper").attr("data-assetimage_id"); var dataToSend = JSON.stringify({ "Asset_ID": assetimage_id, "Description": $(this).val() }); ...
0
votes
0answers
3k views

Origin null is not allowed by Access-Control-Allow-Origin

I have created a mvc4 web api project using vS2012 for JQuery Mobile application(backend is mvc4 and frontend is pure html).I used the following tutorial to solve the Cross-Origin Resource Sharing, ...
0
votes
0answers
82 views

Authorize a user from a client application using asp.net web api

I created an asp.net web api project.I need to know how to authorize a user from a client application. My login controller look like [AllowAnonymous] [HttpPost] public ...
0
votes
1answer
512 views

Post list and variable to WebApi using jQuery Ajax

I am trying to post a list of data and a variable to WebApi using jQuery Ajax. My clientside code is: var datatopost = new Object(); for(var i=0;i<results.length;i++) { datatopost["[" + i + ...
0
votes
1answer
386 views

Problems calling web api from JQuery

I facing some issues while consuming JSon data from JQuery. $(function () { $.getJSON("/api/Movies", function (data) { // ko.mapping.fromJS(data, viewModel); }); This piece ...
0
votes
1answer
368 views

Error while calling parameterized MVC 4 Web API using jquery

I have created a MVC 4 Web API, which expect a parameter. This works fine when I directly call it by putting url in browser. Now I am trying to call this API with data and with complete url(with ...
0
votes
0answers
1k views

ASPNet WebAPI: JSON Deserialization error on POST

UPDATE: This problem is probably due to my lack of understanding of the SPA template and techniques. I tried to ignore the upshot library and did a lot of manual modifications to the template prior to ...