Ok. let me first say I? a newbie to this FTP component, but I?m an experienced developer, hence the frustration.
I'm trying to perform the most basic piece of functionality, which is to upload a file.
I have eliminated the host, server and password for the following reasons -
1) No exceptions are raised
2) I can successfully browse the files
3)Also using Windows explorer I can ftp the files, so I?m confident that the host , server name and password are correct.
Example code fragment -
?..
FTPFile[] dir;
dir = ftp.DirDetails(".");
This works just fine and lists all the folders and files in the root folder.
So why can?t I upload a file, and why are no exceptions raised to tell me what I?m doing wrong?
The code looks like this -
try
{
FTPClient ftp;
ftp = new FTPClient(in_strHost);
ftp.Login(in_strUserName, in_strPassword);
// set up passive ASCII transfers
ftp.ConnectMode = FTPConnectMode.PASV;
ftp.TransferType = FTPTransferType.ASCII;
// copy file to server
ftp.ChDir(".");
strSourceFile = @?c:\temp\test.txt?;
ftp.Put(strSourceFile, "test.txt");
ftp.Quit();
}
catch (Exception e)
{
string strError;
strError = e.Message;
MessageBox.Show( strError);
}
My environment is
Visual Studio.NET 2003
Microsoft Wndows 2000 Professional
Host service provider: www.discountasp.net