- Home /
Issue With System.Net when Using FTP
I'm currently hosting an FTP server and trying to get Unity to connect to it. The server recently implemented client-side certificates and I'm having issues with Unity and System.Net not playing well. I'm getting a "Not Implemented" exception when trying to specify a certificate for my FTPWebRequest. Here is my code:
ftpRequest = (FtpWebRequest)WebRequest.Create(ftpURI);
ftpRequest.Credentials = new NetworkCredential(user, pass);
ftpRequest.EnableSsl = true;
X509Certificate cert = X509Certificate.CreateFromCertFile(certPath);
X509CertificateCollection certCollection = new X509CertificateCollection();
certCollection.Add(cert);
ftpRequest.ClientCertificates = certCollection;
Specifically, here's the error that is getting output from that last line:
System.NotImplementedException: The method or operation is not implemented.
at System.Net.FtpWebRequest.set_ClientCertificates (System.Security.Cryptography.X509Certificates.X509CertificateCollection value) [0x00005] in <9f8c4786222746238eb929db40bf8dd1>:0
at (wrapper remoting-invoke-with-check) System.Net.FtpWebRequest.set_ClientCertificates(System.Security.Cryptography.X509Certificates.X509CertificateCollection)
I've had no issues connecting to the server prior to trying to load in a certificate. I've verified that the certificate is loading in, as I'm able to print out the info from it (and certCollection's Count is 1).
My Unity version is 2019.2.4 and I'm using the .NET 4.x API level, but I'm not sure why this particular function in System.NET is returning as not implemented. I've tried on two different machines so I don't think it's a bad installation.
Has anyone else been able to use use FTP and load in a client certificate without this exception? Is this a quirk of whatever .NET version Unity is currently on? Thanks.
Answer by G-Reusch · Nov 04, 2019 at 07:56 PM
I filed a bug report for this and it turns out it was not implemented in the version of Mono that Unity 2019.2 is on. They plan on updating Mono versionsometime in Unity 2020 which will hopefully resolve this issue.
Your answer
Follow this Question
Related Questions
Issue with TLS and X509 authentication 0 Answers
Download from FTP with Hololens? 0 Answers
XML Deserializer from xml from a web server 0 Answers
BindingList could not be found? 2 Answers