title: C# remote web request certificate error
body: <p>I am getting the following error when trying to perform a HttpWebRequest to a remote server over SSL (the url is <a href="https://sandbox.payfast.co.za" rel="noreferrer">https://sandbox.payfast.co.za</a>):</p>
  
  <p>"The remote certificate is invalid according to the validation procedure"</p>
  
  <p>The certificate seems to be valid and I can successfully make a web request to another url.</p>
  
  <p>Could someone tell me how the .NET validates the certificate and how I can find out the exact problem with the certificate.</p>
  
  <p>To try and bypass this I added:</p>
  
  <pre><code>        ServicePointManager.ServerCertificateValidationCallback 
          = (obj, certificate, chain, errors) =&gt; true;
  </code></pre>
  
  <p>But it seems this will not work in medium trust.</p>
  
  <p>Any help appreciated.</p>
  
  <p>Thanks
  Ben</p>