title: WebRequest fails when ServicePointManager.SecurityProtocol = Tls | Ssl3
body: <p>We have a .Net 4 application which makes an https request to a third party server running Lotus-Domino. We are using the System.Net.WebRequest to make the request. When ServicePointManager.SecurityProtocol is set to the default, i.e. Tls | Ssl3, then the request fails. Specifically WebRequest.GetResponse throws the exception: WebException: "The request was aborted: Could not create SSL/TLS secure channel."</p>
  
  <p>The code is as simple as this:</p>
  
  <pre><code>WebRequest request = WebRequest.Create("https://SOMEURLHERE");
  
  using (HttpWebResponse response = (HttpWebResponse) request.GetResponse())
  {
      using (StreamReader responseReader = new StreamReader(response.GetResponseStream()))
      {
            string responseTest = responseReader.ReadToEnd();
      }
  }
  </code></pre>
  
  <p>Changing ServicePointManager.SecurityProtocol to Ssl3 allows the request to succeed. Using this as a fix presents some challenges. ServicePointManager.SecurityProtocol is static therefore changing it will change all requests in the application. This is something we don't want to do. Changing it and then resetting it back to the default after the request is undesirable because our application makes http requests from multiple treads, introducing a lock would effectively force us to run single threaded for the duration of a possibly lengthy web service call.</p>
  
  <p>The third party Lotus-Domino server can't support TLS.</p>
  
  <p>I have looked at the requests/responses in Wireshark however I not familiar with the protocols therefore I can't see anything meaningful, for me.</p>
  
  <p>Not validating the certificate does not fix the problem, e.g. ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };</p>
  
  <p>I do see this response from the server: "SSLv3 Record Layer: Alert (Level: Fatal, Description: Close Notify)"</p>
  
  <ol>
  <li>Is there a way we can do can set the SecurityProtocol to Ssl3 for a single request?</li>
  <li>Is the something else we can do when SecurityProtocol = Tls | Ssl3 to allow the request work?</li>
  <li>Is there something I could tell our third party, running a Lotus-Domino server to perhaps address the connectivity issue on their side.</li>
  </ol>