title: Why HttpWebRequest.GetRequestStream() tries to connect
body: <p>Maybe this seems like weird question, but I came across the following situation:</p>
  
  <p>I try to make a post request to a service, and to add the post-data I chose make a Stream out of the request and use a StreamWriter to write the body on it. </p>
  
  <p>But, before I actually execute the request (with GetResponse), even before I write to the stream object, I get an "Unable to connect exception" exactly on </p>
  
  <pre><code>var stream = request.GetRequestStream();
  </code></pre>
  
  <p>After a little investigation, I realized that <strong>request.GetRequestStream() is actually trying to connect</strong>. The problem in my case was <strong>network connectivity to the server</strong> (firewall issue).</p>
  
  <p>BUT my question here is <strong>Why HttpWebRequest.GetRequestStream() tries to connect</strong>???</p>
  
  <p>My simple thought was that, while on the request creation, there is no connection to the server of the request. </p>
  
  <p>I found some related questions, such like <a href="https://stackoverflow.com/questions/5325801/httpwebrequest-getrequeststream-what-it-does">this</a></p>
  
  <p>But it does not seem to ansewr my question exactly.</p>
  
  <p>Any explanation please?</p>
  
  <p>PS: Any suggestion of how to avoid this "early" connection effect would be much appreciated.</p>