开发者

Network.Downloadfile always returns "No such file or directory"

开发者 https://www.devze.com 2023-01-26 19:18 出处:网络
I am attempting to use My.Computer.Network.DownloadFile to download a file from an ftp server. Everytime I attempt to download the file using:

I am attempting to use My.Computer.Network.DownloadFile to download a file from an ftp server. Everytime I attempt to download the file using:

My.Computer.Network.DownloadFile("ftp://xxx.xx.xxx.40/datafiles/sm/viewcontrol.ip","c:\rdp\viewcontrol.ip","username","password",false,10000,true)

I receive the following error within the file that is to be downloaded:

Server error message

ISA Server: extended error message :

200 Type set to I.

200 PORT command su开发者_C百科ccessful.

550 /datafiles/sm/viewcontrol.ip: No such file or directory.

I have tried WebClient as well and get the exact same error. I only have this problem in code. The folder and the file name are correct and the user is able to download the file manually using DOS FTP and Internet explorer.


Answer 1

  • Check the filename and full path isn't case sensitive, or are in the correct case.
  • Check you are using the exact same username and password, may exist for one user and not another.

Answer 2

The specified Username and Password parameters could be just for HTTP. Try specifying both the username and password in the URL e.g.

ftp://username:password@xxx.xx.xxx.40/datafiles/sm/viewcontrol.ip

Anwser 3

Something strange about the use of absolute paths, try changing your code to include %2f like this:

My.Computer.Network.DownloadFile("ftp://xxx.xx.xxx.40/%2fdatafiles/sm/viewcontrol.ip","c:\rdp\viewcontrol.ip","username","password",false,10000,true)


In order to get this to work I switched to using FTPWebRequest. Initially, I was getting the same error. However, since the file being downloaded is a text file, I changed the UseBinary property to False and it worked.

0

精彩评论

暂无评论...
验证码 换一张
取 消