I am posting xml from a .net application to a third party web service but receive a "could not create SSL/TLS secure channel" error. When I make the request with soapUI it works fine and i get a response. But cant seem to get it from my .net console app.
I have tried setting the security to tls1 and tls12 but still no success. The certificate is installed on the server from which i am making these requests.
Is there anyone who has managed to solve this issue?
Here is a sample of my code
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://thirdPartyURL/cgi-bin/XmlProc");
byte[] bytes;
bytes = System.Text.Encoding.ASCII.GetBytes("myXML");
request.ContentType = "text/xml; encoding='utf-8'";
request.ContentLength = bytes.Length;
request.Method = "POST";
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
Stream requestStream = request.GetRequestStream();
requestStream.Write(bytes, 0, bytes.Length);
requestStream.Close();
HttpWebResponse response;
response = (HttpWebResponse)request.GetResponse();