title: How do I set the 'ServerCertificateValidationCallback' property back to its default behavior?
body: <p>I use the following line of code within a single method to explicitly check and trust an SSL cert from the following host: MyTrustedCompany.com:</p>
  
  <pre><code>ServicePointManager.ServerCertificateValidationCallback = Function(obj As [Object], certificate As X509Certificate, chain As X509Chain, errors As SslPolicyErrors) (certificate.Subject.Contains("CN=MyTrustedCompany.com"))
  </code></pre>
  
  <p>No problem with the code -> works perfectly 100%.</p>
  
  <p>The problem is, it is too far reaching. I thought its scope would only be within the method I decalred it, but apparently it is a Shared property on the 'ServicePointManager' object, and must then persist for the entire application, which I do not want.</p>
  
  <p>The problem is later I am calling web services of mine, etc and getting the "Could not establish a trust relationship..." exception. This is because in the line of code above I check for the host name of an SSL cert specefic to that method. I quickly tested Returning 'True' from the callback so all certs would be trusted instead of checking for a specefic name (i.e. MyTrustedCompany) and subsiquent requests <strong>worked</strong>.  This is how I know this callback assignment reaches father than that single method.  Sure I could extend the callback to include all other certitificate names, but what I would <em>rather</em> do is set the 'ServerCertificateValidationCallback' back to its default behavior. Like the pseudo code below:</p>
  
  <pre><code>ServicePointManager.ServerCertificateValidationCallback = Nothing  'Default checking behavior
  </code></pre>
  
  <p>How do I remove the custom validation and set it back to its default behavior?  Thanks!</p>