Exception on connect (General questions)
Hi,
I get an exception when I call the connect method. The blocking property is set to true. When blocking is deactivated the exception does not arise.
This is the code:
m_Ftp.put_Blocking(TRUE);
m_Ftp.put_Hostname(host);
m_Ftp.put_Login(user);
m_Ftp.put_Password(passwd);
m_Ftp.put_Protocol(PROTOCOL_FTP);
VARIANT var;
var.vt = VT_ERROR;
m_Ftp.Connect(var,var,var);
The exception that arise just after calling Connect is the following:
Unhandled exception at 0x7c81eb33 in ScriptFTP.exe: Microsoft C++ exception: COleDispatchException @ 0x010bf598.
Re: Exception on connect
Carl,
MFC has tendency to call it exception, while this is just OLE error returned by the client. Can you find numeric representation of the error? Can you try..catch the error and get it's Error.Message?
Perhaps this is just invalid login or something like that.
Hope I helped.
Re: Exception on connect
Thanks,
I've solved it catching the exception this way:
try
{
// Execute some code that might throw an exception.
m_Ftp.Connect(var,var,var);
}
catch( COleDispatchException* e )
{
// Handle the exception here.
e->Delete();
}
Re: Exception on connect
Carl,
cool. I'm just curious - what error was it?
Re: Exception on connect
You were right. It was a login error. I got the error text and number using ErrorText and LastError from the wodFtpDLX component.
Using the exception object in the catch block I get the same error message but a different error number.
Re: Exception on connect
Carl,
if you want to see what error number using exception handler, you can read docs at http://www.weonlydo.com/FtpDLX/Help/GettingStarted_ASP.html (yes, ASP, I know...) Look at 7th item on the help page..