I’m using the following code to download a file from a remote ftp server:
        FtpWebRequest request = (FtpWebRequest)WebRequest.Create(serverPath);
        request.KeepAlive = true;
        request.UsePassive = true;
        request.UseBinary = true;
        request.Method = WebRequestMethods.Ftp.DownloadFile;
        request.Credentials = new NetworkCredential(userName, password);                
        using (FtpWebResponse response = (FtpWebResponse)request.GetResponse())
        using (Stream responseStream = response.GetResponseStream())
        using (StreamReader reader = new StreamReader(responseStream))
        using (StreamWriter destination = new StreamWriter(destinationFile))
        {
            destination.Write(reader.ReadToEnd());
            destination.Flush();
        }
The file that I’m downloading is a dll and my problem is that it is being altered by this process in some way. I know this because the file size is increasing. I have a suspicion that this section of code is at fault:
        destination.Write(reader.ReadToEnd());
        destination.Flush();
Can anyone offer any ideas as to what may be wrong?
 
     
    