Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
code tidy
Source Link
fdomn-m
  • 28.8k
  • 8
  • 39
  • 70

If will work perfect if you specify only TLS in security protocol.

 try  {   ServicePointManager.Expect100Continue = true;   ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;   ServicePointManager.ServerCertificateValidationCallback = delegate {  return true;  };   var webClient = new WebClient();   var s = webClient.DownloadString("https://google.com");   Console.WriteLine(s);  }  catch (Exception ex)  {   Console.WriteLine(ex);  }  Console.ReadLine(); 

If will work perfect if you specify only TLS in security protocol.

 try  {   ServicePointManager.Expect100Continue = true;   ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;   ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };   var webClient = new WebClient();   var s = webClient.DownloadString("https://google.com");   Console.WriteLine(s);  }  catch (Exception ex)  {   Console.WriteLine(ex);  }  Console.ReadLine(); 

If will work perfect if you specify only TLS in security protocol.

try { ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServicePointManager.ServerCertificateValidationCallback = delegate {  return true;  }; var webClient = new WebClient(); var s = webClient.DownloadString("https://google.com"); Console.WriteLine(s); } catch (Exception ex) { Console.WriteLine(ex); } Console.ReadLine(); 
added 74 characters in body
Source Link

If will work perfect if you specify only TLS in security protocol.

 try { ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; var webClient = new WebClient(); var s = webClient.DownloadString("https://google.com"); Console.WriteLine(s); } catch (Exception ex) { Console.WriteLine(ex); } Console.ReadLine(); 
 try { ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; var webClient = new WebClient(); var s = webClient.DownloadString("https://google.com"); Console.WriteLine(s); } catch (Exception ex) { Console.WriteLine(ex); } Console.ReadLine(); 

If will work perfect if you specify only TLS in security protocol.

 try { ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; var webClient = new WebClient(); var s = webClient.DownloadString("https://google.com"); Console.WriteLine(s); } catch (Exception ex) { Console.WriteLine(ex); } Console.ReadLine(); 
Source Link

 try { ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; var webClient = new WebClient(); var s = webClient.DownloadString("https://google.com"); Console.WriteLine(s); } catch (Exception ex) { Console.WriteLine(ex); } Console.ReadLine();