title: How to: Save a StreamReader content in a string
body: <p><strong>How to: Save a StreamReader content in a string</strong></p>
  
  <p>I am trying to save a <code>StreamReader</code> content in a string. Unfortunately, I am not allowed to save the content, because the object seems to be lost (coming from a FTP server).</p>
  
  <p>Error message GERMAN: <strong>Auf das verworfene Objekt kann nicht zugegriffen werden.
  Objektname: "System.Net.Sockets.NetworkStream".</strong></p>
  
  <p>Error message ENGLISH: <strong>There is no access to the castaway object. Object name: "System.Net.Sockets.NetworkStream".</strong></p>
  
  <pre><code>StreamReader streamReader = new StreamReader(responseStream);
  string text = streamReader.ReadToEnd();
  </code></pre>
  
  <p>The error is from line 2.</p>
  
  <hr>
  
  <p><strong>Edit:</strong></p>
  
  <pre><code>public void DownloadFileWithFtp()
      {
          FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://XYZ.bplaced.net/Testumgebung/Texte/" + comboBox_DataPool.SelectedValue);
          request.Credentials = new NetworkCredential("BN", "PW");
          request.Method = WebRequestMethods.Ftp.DownloadFile;
  
          FtpWebResponse response = (FtpWebResponse)request.GetResponse();
          Stream responseStream = response.GetResponseStream();
  
          StreamReader streamReader = new StreamReader(responseStream);
          MessageBox.Show(streamReader.ReadToEnd());
          //textBoxText = streamReader.ReadToEnd();
          streamReader.Close();
  
          MessageBox.Show(response.StatusDescription);
          response.Close();
      }
  </code></pre>