Home c# How to fix: Failed to create a protected SSL / TLS channel?

How to fix: Failed to create a protected SSL / TLS channel?




System.Net.WebException: The request was interrupted: Failed to create a secure SSL / TLS channel. in System.Net.Httpwebrequest.getResponse ()

string html = string.empty;
String url = "https://google.com";
Httpwebrequest request = (httpwebrequest) webrequest.create (URL);
Request.keepalive = True;
// For every firefighter added in solutions to this error I saw the like
Request.credentials = CredentialCache.DefaultCredentials;
Using (httpwebresponse response = (httpwebresponse) Request.getResponse ())
Using (Stream Stream = Response.getResponseStream ())
Using (StreamReader Reader = New StreamReader (Stream))
  HTML = Reader.ReadToEnd ();

Answer 1, Authority 100%

Try to specify the allowable protocols

servicepointmanager.securityprotocol = securityprotocoltype.ssl3 | SecurityProtocoltype.tls | SecurityProtocoltype.tls11 | SecurityProtocoltype.tls12;

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions