I am trying to scrape a site using HTML Agility Pack. The site is using https and it shows the error on this line
doc = web.Load(url);
I am creating a desktop application not a web application.
You need to enable the correct protocol type on the service point manager. Just add it before the line you said caused the error. This should do it.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
doc = web.Load(url);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With