This works:
WebClient client = new WebClient();
client.Headers[HttpRequestHeader.Authorization] = "Basic " + base64;
client.DownloadStringCompleted += getAccessToken_DownloadStringCompleted;
client.DownloadStringAsync(new Uri(URL));
However, i need to move it to HttpClient (because i've started using Portable Class Library), so i got this:
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", base64);
string response = await client.GetStringAsync(URL);
But here the HttpClient fails in the surrounding try/catch saying
Response status code does not indicate success: 400 (Bad Request).
I don't really see any diff....? What might be the problem?