.NET 2.0的FTP客户端库

问题描述:



我正在查看您的FTP客户端代码,但遇到了一些问题.当我尝试列出ftp服务器的文件时.
来自Vb.net:

Hi,

I am looking at your FTP Client code and I am getting a few issues. When I try to list the file(s) of a ftp server.
From Vb.net:

For Each file As FTPfileInfo In ftp2.ListDirectoryDetail(sRemoteDir).GetFiles()
....
Next file


我得到一个返回以下内容的字符串:
(来自ListDirectoryDe​​tail中....Dim str As String = GetStringResponse(ftp))


I get a string returned with the following:
(from in ListDirectoryDetail.... Dim str As String = GetStringResponse(ftp))

<HTML> <HEAD> <TITLE>Directory listing for /out/</TITLE> </HEAD> <BODY> <h2>Current directory is /out/</h2> <br> <hr> <DD><IMG SRC="http://10.142.10.100:80/http://-internal-/02ea93086b12/menu.gif"> <A HREF="ftp://xxxxx:xxxxx111!@101.101.11.111/">..</A></DD> <DD><IMG SRC="http://10.142.10.100:80/http://-internal-/02ea93086b12/text.gif"> <A HREF="ftp://xxxxx:xxxxx111!@101.101.11.111/out/dotnet%20error.txt">dotnet error.txt</A></DD> <DD><IMG SRC="http://10.142.10.100:80/http://-internal-/02ea93086b12/text.gif"> <A HREF="ftp://xxxxx:xxxxx123!@101.101.11.111/out/export.txt">export.txt</A></DD> <hr> </BODY> </HTML>


问题似乎是_ParseFormats不能在其表达式中满足上述格式.你能为我阐明一下吗?我出于安全原因更改了ip等.

Rgds


The problem appears to be that the _ParseFormats does not cater for the above format in it''s expressions. Can you shed some light on this for me? I''ve changed the ip''s etc for security reasons.

Rgds

FTP与文件类型无关,还没有计算文本"和二进制"模式之间的区别,后者已经过时了.因此对于几乎所有实际目的,都应使用二进制".这样,您可以按原样获取/放置文件.

充当FTP客户端.NET太简单了.您所需要的只是使用类System.Net.FtpWebRequest和相关类.请参阅说明和代码示例:
http://msdn.microsoft.com/en-us/library/system.net. ftpwebrequest.aspx [ ^ ].

—SA
FTP has nothing to do with file types, not counting the difference between "text" and "binary" mode which is pretty much obsolete; so for almost all practical purpose "binary" should be used. This way, you can get/put files as is.

Acting as a FTP client .NET is way too simple. All you need is using the class System.Net.FtpWebRequest and related classes. Please see the description and the code sample:
http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx[^].

—SA


将您的问题发布到FTP客户端文章作者以获得更好的答复,该论坛适用于一般性问题.
Post your question to the FTP client article author for a better response, this forum is for general questions.