WebClient和FTPWebRequest“错误550:找不到文件” [英] WebClient and FTPWebRequest "Error 550: File not found"

查看:479
本文介绍了WebClient和FTPWebRequest“错误550:找不到文件”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FTPWebRequest和WebClient来访问远程服务器。我一直收到错误"550:找不到文件"我尝试访问(下载或删除)不在"root"目录中的文件时服务器出错。

I am using FTPWebRequest and WebClient to access a remote server. I keep getting an error "550: File Not Found" error from the server when I try to access (Download or Delete) files that are not in the 'root' directory.

例如,我使用以下代码下载文件

For example, I use the following code to download a file

WebClient request = new WebClient () ;

WebClient request = new WebClient();

request.Credentials = new NetworkCredential (AppSettings.FTPUsername,AppSettings.FTPPassword);

request.Credentials = new NetworkCredential(AppSettings.FTPUsername, AppSettings.FTPPassword);

request.DownloadFile(" ftp://www.onlinefilefolder.com/dir1/ file1.txt ",destFilePath);

request.DownloadFile("ftp://www.onlinefilefolder.com/dir1/file1.txt", destFilePath);

当我执行DownloadFile代码时,我得到"错误550"。信息。我查看了客户端/服务器交互的跟踪文件,发现WebClient类发送以下命令来更改目录:

CWD / Home // dir1

服务器不喜欢Home和dir1之间的两个'/',只需将目录更改为/ Home代替。然后,当我执行RETR命令时,我正在寻找的文件不存在。我也使用FTPWebRequest获得相同的行为。

我手动尝试过完全相同的事情,发现服务器确实无法使用两个'/',但只用一个斜线就可以正常工作。

这是一个错误,还是我做错了什么。任何帮助将不胜感激。我把头发拉过来了。

谢谢,John F. Lund

推荐答案

我遇到了完全相同的问题。有任何修复/解决方法吗?
I am having exactly the same problem. Any fixes/workarounds yet?


这篇关于WebClient和FTPWebRequest“错误550:找不到文件”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆