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.
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.