port from vb6 to c# (wodFtpDLX / wodFtpDLX.NET)
Dear all,
I'm quite new to c# and I'm trying to port a very old application from vb6 to c#. Off course all new code is build from the ground up (based on the vb-code).
I'm getting stuck with a piece of code to connect a certificate to the sftp-object.
Some code:
if (moFTP.State == wodFtpDLXComLib.StatesEnum.Connected) { moFTP.Disconnect(); }
moFTP.Hostname = Bron.IpAdres;
moFTP.ProxyHostname = "";
moFTP.ProxyPort = 1080;
moFTP.ProxyType = 0;
moFTP.Timeout = 600;
moFTP.Passive = false;
moFTP.TransferMode = 0;
moFTP.Compression = 6;
moFTP.Blocking = true;
moFTP.Login = "";
moFTP.Password = "";
WODCERTMNGLib.Certificate certificaat = new WODCERTMNGLib.Certificate();
certificaat.LoadKey(certificatenDirectory + Bron.Certificaat);
moFTP.Certificate = certificaat; <<----- ERROR!!
Error:
Cannot implicity convert type WODCERTMNGLib.Certificate to WodFtpDlxComLib.ICertificate.....
What do I have to do?
Thanks in advance!
Rien.
port from vb6 to c#
Hi Rien.
You can simply cast one object type to another, like this:
moFTP.Certificate = (wodFtpDLXComLib.ICertificate)certificaat;
I hope this helps!
Jasmine.
port from vb6 to c#
Hello Jasmine,
OMG, so simple...
Thank you very much, it works!
Kind regards,
Rien.