OK so after 6 months I have solved this problem! It was several things, the other server (A webmethods Integration Server) is a little picky about what kinds of protocols it accepts. So after some fiddling around here are the two things that fixed it: Servicepointmanager. securityprotocol = securityprotocoltype. ssl3; And Req. protocolversion = httpversion. version10; So the whole code is: Servicepointmanager. expect100continue = true; Servicepointmanager. securityprotocol = securityprotocoltype. ssl3; Httpwebrequest Req = (httpwebrequest) webrequest. Create ("https: // websiteurl: 9000 "); // Header settings Req. method = "Post"; // POST method Req. contenttype = "text/XML"; // content type Req. keepalive = false; Req. protocolversion = httpversion. version10; // Certificate with Private Key X509certificate2 Cert = new x509certificate2 ("Cert. Der", "password "); Req. clientcertificates. Add (CERT ); Req. preauthenticate = true; String xml = "Test message" // reader. readtoend (); Byte [] buffer = encoding. ASCII. getbytes (XML ); Req. contentlength = buffer. length; // Wrap the request stream with a text-based writer Stream writer = Req. getrequeststream (); // Write the XML text into the stream Writer. Write (buffer, 0, buffer. Length ); Writer. Close (); Webresponse RSp = Req. getresponse (); Streamreader responsestream = new streamreader (RSP. getresponsestream ()); Hope this helps someone else in the future. |