title: The server returned an address in response to the PASV command that is different than the address to which the FTP connection was made
body: <blockquote>
    <p>System.Net.WebException: The server returned an address in response to the PASV command that is different than the address to which the FTP connection was made.<br>
       at System.Net.FtpWebRequest.CheckError()<br>
       at System.Net.FtpWebRequest.SyncRequestCallback(Object obj)<br>
       at System.Net.CommandStream.Abort(Exception e)<br>
       at System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage)<br>
       at System.Net.FtpWebRequest.GetRequestStream()<br>
       at BackupDB.Program.FTPUploadFile(String serverPath, String serverFile, FileInfo LocalFile, NetworkCredential Cred) in D:\PROJEKTI\BackupDB\BackupDB\Program.cs:line 119</p>
  </blockquote>
  
  <p>code:</p>
  
  <pre><code>FTPMakeDir(new Uri(serverPath + "/"), Cred);
  FtpWebRequest request = (FtpWebRequest)WebRequest.Create(serverPath+serverFile);
  request.UsePassive = true;
  request.Method = WebRequestMethods.Ftp.UploadFile;
  request.Credentials = Cred;
  byte[] buffer = new byte[10240];    // Read/write 10kb
  
  using (FileStream sourceStream = new FileStream(
      LocalFile.ToString(), FileMode.Open))
  {
      using (Stream requestStream = request.GetRequestStream())
      {
          int bytesRead;
          do
          {
              bytesRead = sourceStream.Read(buffer, 0, buffer.Length);
              requestStream.Write(buffer, 0, bytesRead);
          } while (bytesRead &gt; 0);
      }
      response = (FtpWebResponse)request.GetResponse();
      response.Close();
  }
  </code></pre>