Can not see JSON posting from iPhone to my MVC Rest Service
None of the articles are working for me. It's seems like something so simple but I haven't had any luck.
I've been testing using cURL, Fiddler, and Firefox Poster.
The json object i'm posting is: '{"addressCity":"Miami","addressLine1":"123 Main","addressLine2":"#445","addressState":"fl",addressZip":"33029","companyName":"MyCoInc","email":"me@me.com","firstName":"Pepe","lastName":"Perez","phone1":"305-3333333",phone2":"","phone3":"","phoneFax":""}'
My Model Class is: public class BusinessJoin { public string addressCity { get; set; } public string addressLine1 { get; set; } public string addressLine2 { get; set; } public string addressState { get; set; } public string addressZip { get; set; } public string companyName { get; set; } public string email { get; set; } public string firstName { g开发者_JAVA技巧et; set; } public string lastName { get; set; } public string phone1 { get; set; } public string phone2 { get; set; } public string phone3 { get; set; } public string phoneFax { get; set; }
}
My Controller looks like this:
[HttpPost]
public ActionResult postJoinForm(BusinessJoin myJSON, string APIKEY)
{
var request = HttpContext.Request;
if (ModelState.IsValid)
{
//all good
}
else
{
//no good
}
}
And in my Global.asax.cs file I included the following in Application Start:
ValueProviderFactories.Factories.Add(new JsonValueProviderFactory());
What is going on??
Thanx in advance..
As far as I understand try check in header
Content-Type: application/json; charset: <your_charset>
精彩评论