{"The request was aborted: Could not create SSL/TLS secure channel."}
// I google it and find this 3lines as being helpful - THEY ARE NOT HELPING AT ALL ServicePointManager.Expect100Continue = true; ServicePointManager.DefaultConnectionLimit = 9999; ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls; //(In my VS2010, I only see Ssl3 and Tls,that's it - this may be the cause?) HttpWebRequest request; HttpWebResponse response = null; Stream stream = null; request = (HttpWebRequest)WebRequest.Create("https://www.MyWebsiteToCheck.com/"); request.UserAgent = "Foo"; request.Accept = "*/*"; request.UseDefaultCredentials = true; request.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials; //{"The request was aborted: Could not create SSL/TLS secure channel."} //and response is null. response = (HttpWebResponse)request.GetResponse();//<<<here it breakes stream = response.GetResponseStream(); if (stream != null) stream.Close(); if (response != null) response.Close();
<pre>ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11;
//in .NET 4.0, TLS 1.2 is not supported, but if you have .NET 4.5 (or above) installed on the system //then you still can opt in for TLS 1.2 even if your application framework doesn't support it. //The only problem is that SecurityProtocolType in .NET 4.0 doesn't have an entry for TLS1.2, //so we'd have to use a numerical representation of this enum value: //ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; //instead of: // ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)