I get this error for a specific website, that they announced they made some changes a couple months ago. Now when I check it through c#.... something is not right. The other websites I check are working allright with this code.
Can someone elucidate it for me, please?
{
"
The request was aborted: Could not create SSL/TLS secure channel."
}
I am using this code:
ServicePointManager.Expect100Continue =
true
;
ServicePointManager.DefaultConnectionLimit =
9999
;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
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;
response = (HttpWebResponse)request.GetResponse();
stream = response.GetResponseStream();
if
(stream !=
null
) stream.Close();
if
(response !=
null
) response.Close();
Thank you.
What I have tried:
.................................................................................
ServicePointManager.SecurityProtocol = (SecurityProtocolType)
3072
;
So it was a .NET problem after all. Hmmm.
I am leaving this here with the result i find, maybe it will help others too.
<pre>ServicePointManager.Expect100Continue =
true
;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3 |
SecurityProtocolType.Tls | SecurityProtocolType.Tls11;
Add this line
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback = (snder, cert, chain, error) => true;
It working.
Read the question carefully.
Understand that English isn't everyone's first language so be lenient of bad
spelling and grammar.
If a question is poorly phrased then either ask for clarification, ignore it, or
edit the question
and fix the problem. Insults are not welcome.
Don't tell someone to read the manual. Chances are they have and don't get it.
Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.