Corfo is based on the cookie to work, when it is requested www.corfo.cl, it is first sent to www.corfo.cl/sites/cpp/home, then in / sites / folder, cookie is set jsessionid = OHS_1 ~ T8w78ZolfWgr3ZoEBBvE81nBiXbXIdjfF1In3bgpZiYvL_w8TF4p! 1081543155! -596930586 etc.
With this cookie, this page is built with all / some components related to this jsessionid.
If the client code does not handle this logic, the server resets the connection as expected, because the server does not know how to build this page without jsessionid.
How can I set that cookie so that you can enter the page? The code I have is the following:
var a = "https://www.corfo.cl";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(a);
request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5";
request.Method = "get";
IWebProxy prox = request.Proxy;
prox.Credentials = CredentialCache.DefaultCredentials;
var getHtmlWeb = new HtmlWeb();
getHtmlWeb.UseCookies = true;
CookieContainer cookies = new CookieContainer();
request.CookieContainer = cookies;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
var paginaInicio = getHtmlWeb.Load(a);