Exception on connect - WeOnlyDo Discussion board

Exception on connect (General questions)

by carl, Tuesday, October 11, 2005, 12:53 (6982 days ago)

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

by wodSupport, Tuesday, October 11, 2005, 12:57 (6982 days ago) @ carl

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

by carl, Tuesday, October 11, 2005, 13:56 (6982 days ago) @ wodSupport

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

by wodSupport, Tuesday, October 11, 2005, 13:57 (6982 days ago) @ carl

Carl,

cool. I'm just curious - what error was it?

Re: Exception on connect

by carl, Tuesday, October 11, 2005, 14:10 (6982 days ago) @ wodSupport


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

by wodSupport, Tuesday, October 11, 2005, 14:12 (6982 days ago) @ carl

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