FTp componenet for .Net c#

Posted on 2004-11-28
Last Modified: 2012-05-05
Anybody knows a good ftp component in c#. I ahve search google and i found lots of them but I am just curiouse to see other programmers experince with them. Any good suggestion?
Question by:prokni
    LVL 6

    Accepted Solution

    You could try and

    I really like it, but you could not trust me :-), as I'm biased (I work for Rebex)...
    LVL 9

    Assisted Solution

    here's a simple winapi wrapper that i've used

    using System;
    using System.Runtime.InteropServices;
    public class Ftp
       #region CloseConnection
       [DllImport("WININET.DLL", EntryPoint="InternetCloseHandle")]
       public static extern int CloseConnection(int HINet);

       #region Open
       [DllImport("WININET.DLL", EntryPoint="InternetOpenA")]
       public static extern int Open(string sAgent, int lAccessType, string sProxyName, string sProxyBypass, int lFlags);
       #region Connect
       [DllImport("WININET.DLL", EntryPoint="InternetConnectA")]
       public static extern int Connect(int hInternetSession, string sServerName, int nServerPort,
          string sUsername, string sPassword, int lService, int lFlags, int lContext);
       #region PutFile
       [DllImport("WININET.DLL", EntryPoint="FtpPutFileA")]
       public static extern bool PutFile(int hFtpSession, string lpszLocalFile, string lpszRemoteFile,
          int dwFlags, int dwContext);
       #region MakeDir
       [DllImport("WININET.DLL", EntryPoint="FtpCreateDirectoryA")]
       public static extern bool MakeDir(int hFtpSession, string Directory);
       #region FtpGetCurrentDirectoryA
       [DllImport("WININET.DLL", EntryPoint="FtpGetCurrentDirectoryA")]
       public static extern string GetCurrentDirectory(int FtpSession, string Directory);
       #region GetFile
       [DllImport("WININET.DLL", EntryPoint="FtpGetFileA")]
       public static extern bool GetFile(int hFtpSession, string lpszRemoteFile, string lpszNewFile,
          bool fFailIfExists, int dwFlagsAndAttributes, int dwFlags, int dwContext);

    ************* usage ******************
             int inetSsn = Ftp.Open("WebClientFtpTransfer", 0, null, null, 0);
             if (inetSsn == 0)
                lblResults.Text += "<span class=\"Error\">Could not connect to the FTP Server</span><br>";
             int ftpSsn = Ftp.Connect(inetSsn, ftpServer, 21, ftpUser, ftpPw, 1, 0, 0);

             // check to see if Internet session was successful
             if (ftpSsn == 0)
                lblResults.Text += "<span class=\"Error\">Could not connect to FTP Server: " + ftpServer + "</span><br>";

    // ftpsession is the variable from the connect method
    // local is the fully qualified path for the local file
    // remote is the relative path and file name on the server
                      if (!Ftp.PutFile(FtpSession, local, remote, 0, 0))
                         ret.Append("<span class=\"error\">Error copying file: " + remote.Replace(FtpDirectory, "") + "</span><br>");
                         return ret;


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now