title: HttpWebRequest not downloading file correctly
body: <p>I can't use <code>WebClient</code>, before anyone suggests that because it makes my legit application seem like a virus to McAfee. So please don't suggest that.</p>
  
  <p>I have a binary.txt file stored on my server. It is approximately 1,240kb. However, HttpWebRequest downloads random amounts from 1,300kb to 1,700kb.</p>
  
  <pre><code>HttpWebRequest httpRequest = (HttpWebRequest)
  WebRequest.Create("http://deviantsmc.com/binary.txt");
  httpRequest.Method = WebRequestMethods.Http.Get;
  HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();
  Stream httpResponseStream = httpResponse.GetResponseStream();
  byte[] buffer = new byte[1240];
  int bytesRead = 0;
  StringBuilder sb = new StringBuilder();
  
  //FileStream fileStream = File.Create(@"tcontent.txt");
  while ((bytesRead = httpResponseStream.Read(buffer, 0, 1240)) != 0)
  {
      sb.Append(Encoding.ASCII.GetString(buffer));
      //fileStream.Write(buffer, 0, bytesRead);
  }
  File.WriteAllText(@"tcontent1.txt", sb.ToString());
  </code></pre>
  
  <p>(The contents of the binary.txt file on the server are in ASCII, therefore I get the Encoding string to ASCII as well).</p>
  
  <p>This is how I encoded that text file (on that server)</p>
  
  <p>My file is basically this:</p>
  
  <pre><code>byte[] bytes = File.ReadAllBytes("binary.txt");
  String encBytes = Encoding.ASCII.GetString(bytes);
  File.WriteAllText(file("binary.txt"), encBytes);
  </code></pre>
  
  <p>I contacted the AV company about the <code>WebDownloader</code> being seen as some malicious import in C#, but they didn't get back to me, so I'm forced to use <code>HttpWebRequest</code>.</p>