cancel
Showing results for 
Search instead for 
Did you mean: 

the underlying connection was closed could not establish trust relationship for the SSL/TLS

We get this message once in a while (sorry for the vagueness here) on our production system. We've been using the system for at least 5 years. My beest guess as to how often this happens would be maybe 1% of our transactions. I make the connection using the API with C# code. Thanks for any help, and I'll be happy to provide any other details.

cnpdev45170
Member
2 REPLIES 2

Hello @cnpdev45170

 

I would help if you gave us a bit more information on your operating system and webserver versions.  Are you using XML or SOAP?

 

Richard

RichardH
Administrator Administrator
Administrator

OS is Windows 5.2.3790. I got this by logging on the server and running ver.

 

The web server is IIS 6.

 

I don't know if I'm using XML or SOAP. I send an HTTP request. Here's my code:

 

public static string SendWebRequest (string URL, string PostString)

{

#region "Prepare request"

WebRequest TheRequest;

WebResponse TheResponse;

TheRequest = HttpWebRequest.Create(URL);

TheRequest.ContentType = "application/x-www-form-urlencoded"; // text/html multipart/form-data

TheRequest.Method = "POST";

StreamWriter myWriter = null;

TheRequest.ContentLength = PostString.Length;

#endregion

#region "Send request"

string ResponseAsString = "";

try

{

myWriter = new StreamWriter(TheRequest.GetRequestStream());

myWriter.Write(PostString);

}

catch (Exception e)

{

throw e; // client is responsible for handling exceptions, the try/catch is set to call the finally statements

}

finally

{

if (myWriter != null)

myWriter.Close();

}

#endregion

#region "Get and turn response into a string"

TheResponse = TheRequest.GetResponse();

Stream theResponseStream = TheResponse.GetResponseStream();

StreamReader oStreamReader = new StreamReader(theResponseStream);

ResponseAsString = oStreamReader.ReadToEnd();

oStreamReader.Close();

TheResponse.Close();

#endregion

return ResponseAsString;

}