Bill,
This should get you kick started. If you install and add a reference to your project you can use the following code to send and receive via FTP:
public string SendFileViaFTP(string hostSite, string localFileName, string remoteFileName, string remoteDirName, string userName, string password)
{
string msg = "";
FTPClient oFTP = new FTPClient();
try
{
oFTP.RemoteHost = hostSite.TrimEnd();
oFTP.Connect();
oFTP.Login(userName.TrimEnd(), password.TrimEnd());
if (remoteDirName.TrimEnd() != "")
oFTP.ChDir(remoteDirName);
if (localFileName.Contains(".pgp"))
oFTP.TransferType = FTPTransferType.BINARY;
else
oFTP.TransferType = FTPTransferType.ASCII;
oFTP.Put(localFileName, remoteFileName);
}
catch (Exception e)
{
msg = e.Message;
}
finally
{
if (oFTP.Connected)
oFTP.Quit();
}
return msg;
}
and
public string RetrieveFileViaFTP(string hostSite, string localDirName,
string remoteFileName, string remoteDirName, string userName, string password)
{
FTPClient oFTP = new FTPClient();
string returnMsg = "";
try
{
oFTP.RemoteHost = hostSite.TrimEnd();
oFTP.Connect();
oFTP.Login(userName.TrimEnd(), password.TrimEnd());
if (remoteDirName.TrimEnd() != "")
oFTP.ChDir(remoteDirName.TrimEnd());
if (remoteFileName.Contains(".pgp"))
oFTP.TransferType = FTPTransferType.BINARY;
else
oFTP.TransferType = FTPTransferType.ASCII;
oFTP.Get(localDirName.TrimEnd(), remoteFileName.TrimEnd());
}
catch (Exception e)
{
returnMsg = e.Message;
}
finally
{
if (oFTP.Connected)
oFTP.Quit();
returnMsg = returnMsg + " ";
}
return returnMsg;
}
>Thanks Bob
>
>I downloaded the freebie and I'll try it.
>
>
>>>I have used Enterprise Distributed Technologies for FTP from my .NET application. They have a free version if you are just using regular FTP. I am using it and it works fine and is easy to use. If you want to use SFTP (secure FTP) you would have to pay for their PRO version. Here is the link:
>
>
>
http://www.enterprisedt.com/products.html>
>Hope this helps
>
>Bob