If using 3rd-party tools is an option, you can use this
FTP library for .NET to connect and transfer files. Here is the example code:
Ftp client = new Ftp();
client.Connect("localhost");
client.Authenticate("test", "test");
client.UploadFile("c:\\test.dat", "/test.dat");
client.Disconnect();