title: error: Renci.SshNet.Common.SftpPathNotFoundException: 'No such file' in c#
body: <p>so I have this code:</p>
  
  <pre><code>public static void UploadSFTPFile(string host, string username,
      string password, string sourcefile, string destinationpath, int port)
      {
          string Ip = "";
          String strHostName = string.Empty;
          IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);
          IPAddress[] addr = ipEntry.AddressList;
  
          for (int i = 0; i &lt; addr.Length; i++)
          {
              Ip = (addr[i].ToString());
          }
          using (SftpClient client = new SftpClient(host, port, username, password))
          {
              client.Connect();
              client.ChangeDirectory(destinationpath);
              using (FileStream fs = new FileStream(sourcefile, FileMode.Open))
              {
                  client.BufferSize = 4 * 1024;
                  client.UploadFile(fs, Path.GetFileName(sourcefile));
  
              }
              client.WriteAllText("C:/Users/Public/Documents/192.168.0.112.json", "jeff");
          }
      }
  </code></pre>
  
  <p>I use this method to upload  files in my sftp server.
  this works perfectly, but I also try to write something in the file:</p>
  
  <pre><code> client.WriteAllText("C:/Users/Public/Documents/Test.json", "jeff");
  </code></pre>
  
  <p>this is where I het the error message:</p>
  
  <pre><code>Renci.SshNet.Common.SftpPathNotFoundException: 'No such file'
  </code></pre>
  
  <p>what am I doing wrong this is where the file is located and I am admin.</p>