3

I am trying to upload a file to an FTP server. The FTP server address is sftp://xxx.xx.xx.xx:xx. When I try to make a FtpWebRequest with it. It throws a NotSupportedException that says:

The URI prefix is not recognized.

Code:

FtpWebRequest request = (FtpWebRequest)WebRequest.Create("sftp://xxx.xx.xx.xx:xx");
disasterkid
  • 6,948
  • 25
  • 94
  • 179
  • 1
    sftp is file transfer over SSH, did you mean ftps (FTP with SSL enabled)? – Steffen Ullrich Sep 09 '14 at 10:06
  • @SteffenUllrich I honestly don't know that. I am testing the server and file uploading using FileZilla and it seems to be working fine there and this is the host address I am using to connect to the server. So are you saying that sftp is not ftp and that is why FtpWebRequest rejects it? – disasterkid Sep 09 '14 at 10:09
  • Yes. FtpWebRequest will only work with FTP(S), not with SFTP which is a completely different protocol. FileZilla can do both. – Steffen Ullrich Sep 09 '14 at 10:17
  • @SteffenUllrich can you suggest a solution so I can upload my files using SFTP too please? – disasterkid Sep 09 '14 at 10:21
  • see http://stackoverflow.com/questions/530330/sftp-libraries-for-net – Steffen Ullrich Sep 09 '14 at 10:22

0 Answers0