title: Strange object disposed exception on HttpWebResponse
body: <p>I am working on a program that automatically queries a website every 5 seconds. It has been working fine for the last few days, but today when I simply restarted it, it keeps throwing <code>System.ObjectDisposedException</code> on the line marked underneath. I should mention that accessing this URL via a browser on the same machine works fine.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.bitstamp.net/api/ticker/");
  
  request.Method = "GET";
  
  try
  {
      // ObjectDisposedException thrown here
      using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) 
      {
          using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
          {
              string resultString = reader.ReadToEnd();
              return resultString;
          }
      }
  }
  catch (WebException ex)
  {
      // Handle it
  }
  </code></pre>
  
  <p><strong>Stack Trace:</strong></p>
  
  <pre><code>System.ObjectDisposedException occurred
      _HResult=-2146232798
     _message=Cannot access a disposed object.
      HResult=-2146232798
      IsTransient=false
      Message=Cannot access a disposed object.
  Object name: 'SslStream'.
  Source=System
      ObjectName=SslStream
  StackTrace:
  at System.Net.Security.SslState.ValidateCreateContext(Boolean isServer, String targetHost, SslProtocols enabledSslProtocols, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, Boolean remoteCertRequired, Boolean checkCertRevocationStatus, Boolean checkCertName)
   InnerException: 
  </code></pre>
  
  <p>Is there something I am doing wrong? I do not even access the response stream before the <code>using</code>, how can it be disposed?</p>
  
  <p><strong>EDIT:</strong> Added url and stack trace</p>