I'm having a problem with some characters when I use HTTPCLient, where it would have to come
comes \u003cBR\u003e, I would have to solve this I have to use .Replace("\u003c", "<") .Replace("\u003e", ">")?
Am I using the following code?
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Add(header,
headerAuthenticationValue);
using (HttpResponseMessage response = await client.GetAsync(url))
{
using (HttpContent content = response.Content)
{
var tmpStr = await content.ReadAsStringAsync();
}
}
}
using (HttpClient client = new HttpClient())<- no! Read the docs "HttpClient is intended to be instantiated once and re-used throughout the life of an application. Instantiating an HttpClient class for every request will exhaust the number of sockets available under heavy loads. This will result in SocketException errors."\u003cwould resolve to a unicode character, but since the \ is escaped by an extra \, thus is not parsed correctly.