I have a problem when I trying to make post request by HttpClient. I get InnerException"The underlying connection was closed: An unexpected error occurred on a send.".
string encodedCredentials = Convert.ToBase64String(Encoding.UTF8.GetBytes(login + ":" + password));
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", encodedCredentials);
var content = new StringContent(body);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
return await client.PostAsync(new Uri("https://url"), content);
If I make the same request by Postman everything works fine. Are any idea what problem can be?