title: C# FTP connect to specific PATH bypassing the ROOT
body: <p>I need  to upload files to a specific folders in my ftp server.
  The problem is that the permission to access the ftp is limited to a specific folder which is not the root folder.</p>
  
  <blockquote>
    <p>Sending this request gets me the error 550</p>
  </blockquote>
  
  <p>. 
  It looks like my ftp request goes to the root and than changes to the directory. I need to send the request to the specific path. For example, if use mozilla i can easly do it and not receiving error. </p>
  
  <blockquote>
    <p>(i receive 550 if i connect to the root path first only)</p>
  </blockquote>
  
  <p>any ideas?</p>
  
  <pre><code> Uri target = new Uri("ftp://mtftpserver/folder");
  
      try
      {
  
  
          ftpRequest = (FtpWebRequest)FtpWebRequest.Create(target);        
          ftpRequest.UseBinary = true;
          ftpRequest.UsePassive = true;
          ftpRequest.KeepAlive = true;
  
          ftpRequest.Method = WebRequestMethods.Ftp.UploadFile;        
          ftpStream = ftpRequest.GetRequestStream();
          FileStream localFileStream = new FileStream(localFile, FileMode.Create);
          byte[] byteBuffer = new byte[bufferSize];
          int bytesSent = localFileStream.Read(byteBuffer, 0, bufferSize);
          try
          {
              while (bytesSent != 0)
              {
                  ftpStream.Write(byteBuffer, 0, bytesSent);
                  bytesSent = localFileStream.Read(byteBuffer, 0, bufferSize);
              }
          }
          catch (Exception ex) { Console.WriteLine(ex.ToString()); }
          localFileStream.Close(); 
          ftpStream.Close();
          ftpRequest = null;
      }
  
  
      catch (Exception ex) { Console.WriteLine(ex.ToString()); }
  
      return;
  </code></pre>