ftps协议怎么连接服务器,使用”ftps”前缀连接到FTP服务器

  • Post author:
  • Post category:其他


I’ve exhausted all my resources at this point, so I come asking for help.

I have a client that has given me a username and password to their ftp site. However, to access it on the web uses https://ftps.sitename.com

To access on FileZilla, I can either use ftps:// or sftp://

My problem is that I have no idea what I need to do to access it inside my program.

Right now I have this code:

var ftpFilePath = @”ftp://ftps.sitename.com/file.txt”;

var request = (FtpWebRequest)WebRequest.Create(ftpFilePath);

request.Method = WebRequestMethods.Ftp.DownloadFile;

request.Credentials = new NetworkCredentials(username, pass);

// enable SSL?

var response = (FtpWebResponse)request.GetResponse();

// Other code

It’s currently failing on GetResponse with the error that it cannot connect to the remote server. If I use “ftps