My question is very similar to Calling MVC4 WebAPI methods from C# Metro UI Client using PostAsync, HttpClient & Json which was not sufficient for me to resolve my problem.
Here is my code in a Windows Phone 8.1 project :
using (var httpClient = new HttpClient())
            {
                httpClient.BaseAddress = new Uri(baseAddress);
                httpClient.DefaultRequestHeaders.Accept.Clear();
                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "YW5vbnltb3VzOmFub255bW91cw==");
                var message = "{ \"userName\" : \"WebAppUser\", \"password\" : \"M@mie!duCanta1l\" }";
                var json_object = JsonConvert.SerializeObject(message);
                HttpContent content = new StringContent(json_object.ToString(), Encoding.UTF8);
                content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                HttpResponseMessage response = httpClient.PostAsync(baseAddress + "/s/VpCredentials/1.0/IAuthentication/REST_JSON/Validate", content).Result;
                string statusCode = response.StatusCode.ToString();
                response.EnsureSuccessStatusCode();
                Task<string> responseBody = response.Content.ReadAsStringAsync();
            }
responseBody would always return a short piece of html with https://m.vente-privee.com/f/fail_int.png in it, indicating the call failed. The same call built in Postman in Chrome returns the following successful string :
{
    "ValidateResult": {
        "Expiration": "/Date(1404214568532+0200)/",
        "Token": "P36Hm9K9zI1gm75hfOqI6hudfdGw8y7Zu1fVgbaSHp7ayvfLUn4YtNxU/8siJ7Wa",
        "UserName": "WebAppUser"
    },
    "result": 1,
    "analytics": true
}

Do you have any idea what I'm doing wrong in my C# code ? Thanks.
 
     
    