The purpose of my code is to upload some data to a FTP location.
With my code I keep getting an error stating that the remote server requires SSL. I am using a .NET version greater then 4. All the other posts suggest I add the ServicePointManager
code that I have below.
The exception occurs on client.UploadData
.
Still no dice. Any help would be very much appreciated.
ServicePointManager.ServerCertificateValidationCallback +=
(sender,certificate, chain, sslPolicyErrors) => true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
byte[] data = stream.ToArray(); //Data I want to upload to FTP location
using (WebClient client = new WebClient())
{
client.Credentials = new NetworkCredential("*Username*", "*Password*");
client.UploadData("ftp://file.example.com/Content/file", "STOR", data);
}