title: Saving stream object returned by webrequest
body: <p>I have a code to retrieve an XML file from the site, so I do as follows:</p>
  
  <pre><code>WebRequest request = WebRequest.Create(url);
  request.Method = "GET";
  request.ContentType = "text/xml";
  
  using (WebResponse webResponse = request.GetResponse())
  {
      using (Stream responseStream = webResponse.GetResponseStream())
      {
         if (responseStream != null)
          {
              reportXML = XDocument.Load(responseStream.ToString());
          }
      }
      using (XmlWriter writer = XmlWriter.Create(@"C:\Retrieved.xml"))
      {
          reportXML.Save(writer);
      }
   }
  </code></pre>
  
  <p>But I debugged the app and it seems I lose everything on this line of code, so I have nothing anymore to save.</p>
  
  <pre><code>Stream responseStream = webResponse.GetResponseStream())
  </code></pre>
  
  <p>Any idea why it could be? </p>
  
  <p>If I investigate the object I see this:</p>
  
  <blockquote>
    <p>Length = 'responseStream.Length' threw an exception of type
    'System.NotSupportedException'</p>
  </blockquote>
  
  <p>And the error is following:</p>
  
  <blockquote>
    <p>Could not find file 'C:\Documents and Settings\user\My
    Documents\Visual Studio
    2010\Projects\Proto\App\bin\Debug\System.Net.ConnectStream'.</p>
  </blockquote>