I have tried to load a web page into my program using Get web page using HtmlAgilityPack.NETCore . The problem is that debugging jumps directly off the first Using statement, so the code and the second using are not called at all. No Exception or something else is thrown. Program ends with exit code 0 What am I doing wrong? I am working with .net Core 2.2
HttpClient client = new HttpClient();
List<string> htmlContent = new List<string>();
using (var response = await client.GetAsync(URL))
{
using (var content = response.Content)
{
var result = await content.ReadAsStringAsync();
var document = new HtmlDocument();
document.LoadHtml(result);
foreach (HtmlNode node in document.DocumentNode.SelectNodes("//text()"))
{
htmlContent.Add(node.InnerText);
}
}
}