Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not catching error in FTP

Status
Not open for further replies.

sandease

Programmer
Jul 18, 2003
12
US
I am not catching the error when the FTP process fails in the following code. The CONET FTP object does not throw an exception. How can I code a boolean to catch the ftp failure?

try
{
FTP objFTP = new CONET.FTPClass();
System.Object lngFTPConn = objFTP.FTPConnect(strHost,strUser,strPass);
objFTP.FTPPut(ref lngFTPConn,strLocFile, strRemoteFile);
objFTP.CloseHandle(ref lngFTPConn);
System.Diagnostics.Trace.WriteLine("Successfully ftp'd "+strLocFile);

catch(Exception e)
{
System.Diagnostics.Trace.WriteLine(e.Message);
System.Diagnostics.Trace.WriteLine(string.Format("FAILED - Unable to ftp {0} - Program ENDED", strLocFile));
EndSystemDiagnosticsLogging();
return;
}

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top