I'm getting this header from fiddler.
POST http://localhost:8887/api/values HTTP/1.1
Host: localhost:8887
Proxy-Connection: keep-alive
Content-Length: 352
Accept: */*
Origin: http://localhost:8383
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://localhost:8383/comandaApp/principal.html
Accept-Encoding: gzip, deflate
Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4
{"IDEmpresa":"1","IDTabelaPreco":"1","numeroVendedor":"1","IDCupomFiscal":"","IDGrupo":"1","IDUsuario":"1","IDVendedor":"1","NMMesa":"3","IDMesa":"3","STCartao":"N","STViagem":"N","STDelivery":"N","modalidadeDelivery":"","observacaoDelivery":"","localEntrega":"","comandaItemPojo":[{"IDProduto":"162","NRReferencia":"","QTDProduto":1,"observacao":""}]}
O submission to webAPI
$.ajax({
type: 'POST',
crossDomain: true,
url: "http://localhost:8887/api/values",
data: JSON.stringify(comandaPojo),
success: function(retorno)
{
//códigos....
}
At WEBAPI it's like this
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Mvc;
namespace webapi_MVC5.Controllers
{
public class ValuesController : ApiController
{
public void Post([FromBody]string value)
{
string a = value; //VALUE RETORNA NULL
string b = "x";
}
}
}
I have already added this line in webconfig
<add name="Access-Control-Allow-Origin" value="*" />
I only get NULL
in parameter value
.
What can it be? my IIS is connected as my local user (with password). Is there anything to see?