Нужно загрузить pdf файлы на сервер по ftp. Код :
string username = "myserwer@forfile.sg";
string Pass = "qwerty";
string URLpath= "http://ftp.adress.co.uk/";
string filePath;
try
{
filePath = FullPath.Text;
using (WebClient client = new WebClient())
{
client.Credentials = new NetworkCredential(username, Pass);
client.BaseAddress = URLpath;
client.UploadFile(WebRequestMethods.Ftp.UploadFile, filePath);
}
}
catch (Exception ex)
{
MessageBox(ex.Message, ex.Source);
}
Вылетает ошибка :
Базовое соединение закрыто : Соединение было неожиданно закрыто.
Как исправить?
string URLpath= "ftp://ftp.adress.co.uk/";
а неstring URLpath= "http://ftp.adress.co.uk/";
– koshe 21 июн '17 в 10:41