title: Webrequest work over HTTP but not over HTTPS (SSL)
body: <p>We have a rest service which works fine over http. I use the following C# code to post data to it:</p>
  
  <pre><code>    string postData = [contains the data to post]
      ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
      var baseAddress = "http://www.myserver.net/rest/saveData";
      System.Net.WebRequest req = System.Net.WebRequest.Create(baseAddress);
      string authInfo = "username:password";
      authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
      req.Headers["Authorization"] = "Basic " + authInfo;
      req.ContentType = "application/x-www-form-urlencoded";
      req.Method = "POST";
  
      byte[] bytes = System.Text.Encoding.ASCII.GetBytes(postData);
      req.ContentLength = bytes.Length;
  
      System.IO.Stream os = req.GetRequestStream();
      os.Write(bytes, 0, bytes.Length); //Push it out there
      os.Close();
  
      System.Net.WebResponse resp = req.GetResponse();
      var s = resp.GetResponseStream();
  
      var sr = new System.IO.StreamReader(s);
      var r= sr.ReadToEnd().Trim();
  </code></pre>
  
  <p>Now if change this to SSL, replacing the http call with a https call:</p>
  
  <pre><code>"https://www.myserver.net/rest/saveData";
  </code></pre>
  
  <p>This does not work, as it timeout at the GetReponse call. First I thought is was caused by a self signed certificate, but this is not the case as I use:</p>
  
  <pre><code>ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
  </code></pre>
  
  <p>Which accepts all certificates. The error I get is something like zero bytes returned on transportlayer (it is in my language, so I don't know exactly what the english exception is)</p>
  
  <p>I use CURL on the commandline to test the calls and there it works both on http and SSL, so the rest service seems to fine.</p>
  
  <p>Does anybody have an idea why it does not work over SSL?</p>
  
  <p>Thanks</p>