Cleaning up htmlagilitypack

I am using HtmlAgilityPack to do Scraping in C # Asp.Net, so far I have had no problem executing Scratch from multiple webpages, however, while trying to extract the following code, I get the error

Var getHtmlWeb = new HtmlWeb ();
Var home page = getHtmlWeb.Load ("https://www.corfo.cl/sites/cpp/home");

      

An error message appears:

"Connection ended: unexpected send error."

The only network that is giving me problems is Corfo, not how to fix this problem. I appreciate your help.

+3


source to share


1 answer


This site uses cookies to work, for example. one of the requested urls https://www.corfo.cl/sites/Satellite;jsessionid=T8w78ZolfWgr3ZoEBBvE81nBiXbXIdjfF1In3bgpZiYvL_w8TF4p!1081543155!-596930586/596930586

So when you request www.corfo.cl first go to www.corfo.cl/sites/cpp/home, then to / sites / folder, set cookie jsessionid = OHS_1 ~ T8w78ZolfWgr3ZoEBBvE81nBiXbXIdjfF1In3bgpZiYvL_w8TFF1In3bgpZiYvL_w8TF 1081543155! -596930586, etc.

With this cookie, this page is built with all / some of the components associated with this jsessionid.



If the client code doesn't handle this logic as above, two lines, the server will reset the connection as expected, because the server doesn't know how to create this page without the jsessionid.

Inner exception from System.Net.WebException {"Authentication failed because the remote side closed the transport stream."}

Hope this helps!

+1


source







All Articles