The underlying connection was closed: An unexpected error occurred on a receive
<pre> var ftpClient = (FtpWebRequest)WebRequest.Create(new Uri(string.Format(@"ftp://{0}/{1}", ftpAdress, folder))); ftpClient.Credentials = new NetworkCredential(user, pass); ftpClient.Method = WebRequestMethods.Ftp.UploadFile; ftpClient.UseBinary = true; ftpClient.KeepAlive = true; ftpClient.Timeout = 10000000; ftpClient.ReadWriteTimeout = 10000000; ftpClient.UsePassive = true; var fileInfo = new FileInfo(dbPath); ftpClient.ContentLength = fileInfo.Length; var buffer = new byte[fileInfo.Length]; var bytes = 0; int totalBytes = (int)fileInfo.Length; fs = fileInfo.OpenRead(); rs = ftpClient.GetRequestStream(); while (totalBytes > 0) { bytes = fs.Read(buffer, 0, buffer.Length); rs.Write(buffer, 0, bytes); totalBytes = totalBytes - bytes; } //fs.Flush(); fs.Close(); rs.Close(); uploadResponse = (FtpWebResponse)ftpClient.GetResponse(); uploadResponse.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)