Re: wodFtpDLX Hostcertificate event with FileZilla - WeOnlyDo Discussion board

Re: wodFtpDLX Hostcertificate event with FileZilla (General questions)

by newP, Monday, October 26, 2009, 22:56 (5507 days ago) @ wodDamir

Thanks Damir,
Ok...lets take it setp by step. I am following the 2. COM Object With Events ( on my disk resides at C:Program FilesWeOnlyDo.ComFtpDLXSamplesVCMFC) sample that came with WOD. Originally the sample is using Certificate authentication. So I made changes to it to do just that. Below is the code for OnConnect method in 'WithEventsView.cpp'. This is the only function I have changed and you can compare this to see the changes from the original one.

void CWithEventsView::OnConnect()
{
VARIANT var;

var.vt = VT_ERROR;

ICertificate Cert;
LPCTSTR certPath;
VARIANT cPass;
AfxVariantInit(&cPass);
certPath = C:\Program Files\FileZilla Server\FZCert.crt ;
int iPort = 990;


// no arguments

UpdateData(TRUE);
int prot = m_Protocol.GetCurSel();
Cert.Load(certPath,cPass);
Cert.LoadKey(certPath,cPass);
m_Ftp.SetHostname(m_strHostname);
m_Ftp.SetLogin(m_strLogin);
m_Ftp.SetPassword(m_strPassword);
m_Ftp.SetProtocol(prot);
m_Ftp.SetPort(iPort);
m_Ftp.SetAuthentication(2);

VARIANT varHost;
AfxVariantInit(&varHost);
varHost.vt =VT_BSTR;
varHost.bstrVal = m_strHostname.AllocSysString();

VARIANT varPort;
AfxVariantInit(&varPort);
varPort.vt=VT_I4;
varPort.iVal=iPort;

VARIANT varProtocol;
AfxVariantInit(&varProtocol);
varProtocol.vt=VT_I4;
varProtocol.iVal=prot;
Debug( CONNECTING...
);

m_Ftp.Connect(varHost,varPort,varProtocol);
}

This is giving me 'unknown exception' on the last statement where it actually connects. You might have noted from my previous posts that the exact same code works in VB 6.0 and I also get HostCertificate event. I can zip and send the VB 6.0 sample if you need me to.
So I wish this sample to work the same way, first connect using authCertificate, and then GetFiles and PutFiles.
Thats all!

Your help is greatly appreciated.
Thanks


Complete thread: