Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am getting an error as "An existing connection was forcibly closed by the remote host."

I am not sure FTP server has open the port 990.

my code as follows
FtpWebRequest request = null;
FtpWebResponse response = null;

request = (FtpWebRequest)WebRequest.Create(new Uri("ftp://ftp.example.com:990"));

request.UsePassive = true;
request.Method = WebRequestMethods.Ftp.ListDirectory;
request.Credentials = new NetworkCredential(username, password);
request.Proxy = null;
request.EnableSsl = true;
request.UseBinary = false;
request.KeepAlive = false;

request.Timeout = int.MaxValue;
request.ReadWriteTimeout = int.MaxValue; //10000000;
response = (FtpWebResponse)request.GetResponse();

But i am able to access through CoreFtp by using port 990 and while using CoreFtp to connect to FTP server it pops up a window which has Server certificate if i accept the certificate then i am connected to the FTP server.
Please help me what is the issue i am trying for this for couple of days.

How to handle the FTP server certification in my C# program?
I am getting error while getting response, i.e, request.GetResponse().
I am not sure the connection is established or not.

Thanks in advance
Posted
Updated 21-Jul-11 3:00am
v2

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900