.NET ez 2012-06-26
本篇利用 FTP Class 連線到 FTP,並且將檔案列出來!
FtpConnection connection = new FtpConnection(); connection.MessageReceived += new FtpConnectionEventHandler(Ftp.connection_MessageReceived); connection.Host = "ftp://xxx.xxx.xxx/"; connection.UserName = "xxx"; connection.Password = "xxxxxx"; connection.RemoteDirectory = ""; //列出資料夾內的檔案及資料夾 List<string> files = connection.ListDirectory(); foreach (string file in files) { Response.Write(file + "<br>"); }
範例檔案:Ftp_List
結果截圖:
標籤: .NET
本文章網址:
https://www.ez2o.com/Blog/Post/csharp-FTP-Client-Sample-Code
https://www.ez2o.com/Blog/Post/267
https://www.ez2o.com/Blog/Post/csharp-FTP-Client-Sample-Code
https://www.ez2o.com/Blog/Post/267