Share via


How to connect to FTPS:// for get files

Question

Monday, April 18, 2016 2:27 PM

Hi friends,

I need to connect to ftps://dda-ft-prd01.test.com by code c#.

I dont understand hpw to do this, I see that to connect to ftp// is not problem by this code:

 FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create("ftp://dda-ft-prd01.test.com");
            ftpRequest.Credentials = new NetworkCredential("user", "password");
            ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory;
            FtpWebResponse response = (FtpWebResponse)ftpRequest.GetResponse();
            StreamReader streamReader = new StreamReader(response.GetResponseStream());

but i need to FTPS.

Can you help me please, 

Thank You,

Regards..

All replies (5)

Wednesday, April 20, 2016 5:19 AM âś…Answered

I found the answer, if I write "ftpRequest.EnableSsl = true;", its mean that now is FTPS. Its work/

Thank you for your help

 FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create("ftp://dda-ft-prd01.psagot.co.il");
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
            ftpRequest.Credentials = new NetworkCredential("test_download", "Aa123456");
            ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory;
            ftpRequest.EnableSsl = true;
            ftpRequest.UsePassive = true;
            FtpWebResponse response = (FtpWebResponse)ftpRequest.GetResponse();
            StreamReader streamReader = new StreamReader(response.GetResponseStream());

Monday, April 18, 2016 8:30 PM

http://www.rebex.net/support/tutorial/ftp-ssl/


Tuesday, April 19, 2016 7:11 AM

Why I have to go to a third party?
Via dot net can not I?

Thank you


Tuesday, April 19, 2016 7:21 AM

Even .Net doesn't wrap everything for you. Sometimes these kind of things can be complex enough that its just easier to buy a 3rd-party tool.

Having said that, there are sites out there that purport to show you how to do this. E.g. this one  (which I have not tried).


Tuesday, April 19, 2016 2:17 PM

Hi YoniAL,

.NET Framework does not support FTPS natively. You could also use SFTP for secure file transfer. Also FTPS and SFTP are two very different thing see the difference here. Hope this helps you.

Rebex SFTP

Thanks,

Sabah Shariq