从FTP服务器文件中读取数据 [英] Read Data from FTP Server File

查看:556
本文介绍了从FTP服务器文件中读取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用C#在FTP服务器中读取文件。我有这个代码:



I want to read a file in FTP Server using C#. I have this code:

public int getFTPData()
    {
        WebClient request = new WebClient();
        string url = "ftp://URL" + "CustStat.csv";
        request.Credentials = new NetworkCredential("username", "password");
        int result = -1;

        try
        {
            //I do not know what to put here in order to read the files.
            //This is the condition I want: If data in CSV exist then result = 0 if not result=1
        }
        catch (WebException e)
        {
            System.Windows.Forms.MessageBox.Show("Error getFTPData: " + e.ToString());
        }

        return result;
    }





我要读的文件是CSV。



The file I am going to read is CSV.

推荐答案

到目前为止你尝试了什么?



一个简单的 Google [ ^ ]搜索可以提供帮助。



看看这篇文章。应该帮助你走得更远:



http ://stackoverflow.com/questions/6098694/read-file-from-ftp [ ^ ]
What have you tried so far?

A simple Google [^]search could help.

Look at this article. Should help you to go further:

http://stackoverflow.com/questions/6098694/read-file-from-ftp[^]


这篇关于从FTP服务器文件中读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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