Is it possible to use C # FtpWebRequest through an FTP proxy?

As I understand it, the property FtpWebRequest.Proxystands for HTTP proxy. I have to send FTP requests to an external server through an FTP proxy.

The only way I still work is to create a script that uses the Windows FTP command and loads this path.

Can I use FtpWebRequestto upload files via FTP proxy?

+3
source share
6 answers

If you have a budget for this - Dart makes cool classes for this:

http://www.dart.com/ or specifically http://www.dart.com/ptftpnet.aspx

+1
source

, , , Checkpoint, USER PASS FTP-. .

FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(
       new Uri("ftp://FTP PROXY HOST/actual/path/to/file/on/remote/ftp/server"));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;

reqFTP.Credentials = new NetworkCredential
       ("REMOTE FTP USER@FTP PROXY USER@REMOTE FTP HOST"
       , "REMOTE FTP PASSWORD@FTP PROXY PASSWORD");
+3

, , , FtpWebRequest - ftp, URL-

"ftp://your.proxy.server/theFileToDownload")" 

username="ftpUserName@ftp.realserver.com" 

password="password". 

, WININET, .

YMMV, .

+1

- FTP USER PASS, Credentials.

, user@proxyuser@host password@proxypassword:

FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://proxy/path");
request.Credentials = new NetworkCredential("user@proxyuser@host", "password@proxypassword");

- , user@host password:

FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://proxy/path");
request.Credentials = new NetworkCredential("user@host", "password");

- , :

  • USER - -
  • OPEN
  • SITE

FtpWebRequest. FTP.

, WinSCP.NET :

// Setup session options
SessionOptions sessionOptions = new SessionOptions
{
    Protocol = Protocol.Ftp,
    HostName = "host",
    UserName = "user",
    Password = "password",
};

// Configure proxy
sessionOptions.AddRawSettings("ProxyHost", "proxy");
sessionOptions.AddRawSettings("FtpProxyLogonType", "2");
sessionOptions.AddRawSettings("ProxyUsername", "proxyuser");
sessionOptions.AddRawSettings("ProxyPassword", "proxypassword");

using (Session session = new Session())
{
    // Connect
    session.Open(sessionOptions);

    // Your code
}

SessionOptions.AddRawSettings . .

WinSCP GUI # FTP .

, WinSCP.NET - .NET. .NET .

( WinSCP)

+1

, Atp. , , .

0

, , listdetails . isa. - app.config ForeFront/ISA. c:\programdata\microsoft\firewall client 2004\application.ini :

[ApplicationName] DisableEx = 0 = 0 NameResolution = R

applicationName - exe .exe.

-1

Source: https://habr.com/ru/post/1762816/


All Articles