Click here to Skip to main content
15,117,549 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to read a file in FTP Server using C#. I have this code:

C#
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;
    }


The file I am going to read is CSV.
Posted

1 solution

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[^]
   
Comments
mitchiee1226 14-Apr-14 21:46pm
   
i have already gone to that site.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900