1

There are many questions like this, but answers which should help me, they did not do that.

        private static string GetWebText(Uri url)
    {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

        ServicePointManager.Expect100Continue = true;
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3
                                   | SecurityProtocolType.Tls
                                   | SecurityProtocolType.Tls11
                                   | SecurityProtocolType.Tls12;
        ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };


        request.UserAgent = "A .NET Web Crawler";
        WebResponse response = request.GetResponse();
        Stream stream = response.GetResponseStream();
        StreamReader reader = new StreamReader(stream);
        string htmlText = reader.ReadToEnd();
        return htmlText;
    }

This is my code, and when I am trying to request some URL, I am getting

The request was aborted: Could not create SSL/TLS secure channel

Someone could help me? I am missing something?

The same URL which I am trying to request, working in Browser.

Thanks!

Blagalin
  • 609
  • 1
  • 8
  • 16
  • What version of .Net framework? I think you need at least 4.5 for newer versions of TLS. – Crowcoder May 21 '17 at 13:43
  • Use a sniffer like wireshark or fiddler and compare the browser results with the webrequest. Look at the html headers for differences. – jdweng May 21 '17 at 13:47
  • Does this answer your question? [The request was aborted: Could not create SSL/TLS secure channel](https://stackoverflow.com/questions/2859790/the-request-was-aborted-could-not-create-ssl-tls-secure-channel) – Simon Dugré Nov 28 '19 at 14:19

0 Answers0