Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Распределённые приложения и сеть > ftp client


Автор: kobra 29.4.2013, 09:59
Здравствуйте господа

возникла проблема при создании ftp client-а. поиск в инете не помог.
сервер:
FileZilla
Protokol - FTP
Encription - Require explicit FTP over TLS
transfer type - Passive
Disalow plain unencripted FTP

вот мой код:
Код

        static void Main(string[] args)
        {
            try
            {
                FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(@"ftp://devapp:30000");
                ftpRequest.EnableSsl = true;
                ServicePoint sp = ftpRequest.ServicePoint;
                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(OnCertificateValidation);
                ftpRequest.UsePassive = true;
                ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory;
                ftpRequest.Credentials = new NetworkCredential("constbtest", "constbt$1");
                FtpWebResponse ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            Console.Read();
        }

        private static bool OnCertificateValidation(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
        {
            if ((errors != SslPolicyErrors.None) && (errors != SslPolicyErrors.RemoteCertificateNameMismatch))
            {
                return false;
            }
            else
            {
                return true;
            }
        }

ошибка: The remote certificate is invalid according to the validation procedure.
а вот лог сервера:
Цитата
000001)29/04/2013 10:47:39 - (not logged in) (192.168.111.137)> Connected, sending welcome message...
(000001)29/04/2013 10:47:39 - (not logged in) (192.168.111.137)> 220-FileZilla Server version 0.9.41 beta
(000001)29/04/2013 10:47:39 - (not logged in) (192.168.111.137)> 220-written by Tim Kosse ([email protected])
(000001)29/04/2013 10:47:39 - (not logged in) (192.168.111.137)> 220 Please visit http://sourceforge.net/projects/filezilla/
(000001)29/04/2013 10:47:39 - (not logged in) (192.168.111.137)> AUTH TLS
(000001)29/04/2013 10:47:40 - (not logged in) (192.168.111.137)> 234 Using authentication type TLS
(000001)29/04/2013 10:47:40 - (not logged in) (192.168.111.137)> SSL connection established
(000001)29/04/2013 10:47:41 - (not logged in) (192.168.111.137)> disconnected.


спасибо 


Автор: jonie 20.6.2013, 10:25
в OnCertificateValidation вообще попаете? Там что надо вернули?

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)