FtpWebRequest不会更改目录 [英] FtpWebRequest won't change directory
本文介绍了FtpWebRequest不会更改目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
reqFTP =(FtpWebRequest)WebRequest.Create
(新 Uri(" + ftpServerIP + " + fileName)));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true ;
reqFTP.UsePassive = false ;
reqFTP.Credentials = 新 NetworkCredential(ftpUserID,ftpPassword);
FtpWebResponse响应=(FtpWebResponse)reqFTP.GetResponse();
我也尝试过这样的Uri
Uri(" + ftpServerIP + " + fileName)
但设备会回答:
550 Cannot find the file /system/filename.\r\n
:(但是,当我使用套接字编程并发送命令
" + directoryName
我能够获取文件.FtpWebRequest有什么问题?
解决方案
尝试查看此MSDN修复文章. FIX:在FTP 7.5服务器上找不到文件时,您会收到一条错误消息:"550-系统找不到指定的文件" [^ ].
除此之外,请参见下面的链接.
1. 使用FtpWebRequest通过SSL进行FTP [ ^ ]
2. 错误550-无法访问文件 [ ^ ]
hi
I need to connect to a device via ftp, change directory to system and then get some files from it. I use code below
reqFTP = (FtpWebRequest)WebRequest.Create
(new Uri("ftp://" + ftpServerIP + "/system/" + fileName));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.UsePassive = false;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
I also tried the Uri like this
Uri("ftp://" + ftpServerIP + "/%2fsystem/" + fileName)
but the device answers:
550 Cannot find the file /system/filename.\r\n
:( but when i use the socket programming and send the command
"CWD " + directoryName
I am able to get the file. what''s wrong with FtpWebRequest??
解决方案
Try to see this MSDN fix article.FIX: You receive an error message when no file is found on an FTP 7.5 server: "550-The system cannot find the file specified"[^].
In addition to this see the links below.
1. Using FtpWebRequest to do FTP over SSL[^]
2. Error 550 - Can''t Access File[^]
这篇关于FtpWebRequest不会更改目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文