-1

Im able to connect to the sftp server am able to get the list of files in "pickup" directory. But I can't download any of those files. Here is my code:

try
{
    sftp.Get(txtRemotePath.Text + txtFixedFileName.Text, txtLocalPath.Text + txtFixedFileName.Text);
    //example:
    //txtRemotePath.Text + txtFixedFileName.Text = "/pickup/temp.txt";
    //txtLocalPath.Text + txtFixedFileName.Text = @"C:\Users\...\temp.txt"
}
catch (Exception ex)
{
    lblError.Text += "\n" + ex.Message;
}

I tried modifiying the local and remote paths switching betwen slashes "/" and back-slashes "\", removing/addding starting slashes in remote path.. unfortunatly same error is generated:

Exception of type 'Tamir.SharpSsh.jsch.SftpException' was thrown

AbeerAhdab
  • 66
  • 1
  • 8

3 Answers3

1

It was The sftp server security that didn't allow me to download files!

AbeerAhdab
  • 66
  • 1
  • 8
1

check the sftp server security to allow you in through specific port

ibrahim
  • 63
  • 1
  • 1
  • 9
0

I received the same error when uploading a file. I realised though that I did not have permission to the root directory. When using a folder with the correct permissions I could upload the file successfully.

brightfunction
  • 159
  • 1
  • 6