FTP File Upload with HTTP Proxy

前端 未结 13 1938
轻奢々
轻奢々 2020-12-05 07:48

Is there a way to upload a file to a FTP server when behind an HTTP proxy ?

It seems that uploading a file is not supported behind an HTTP Proxy using .Net Webclient

13条回答
  •  死守一世寂寞
    2020-12-05 08:25

    Our Rebex FTP/SSL can use HTTP proxy. It's not free, though...

    // initialize FTP client 
    Ftp client = new Ftp();
    
    // setup proxy details  
    client.Proxy.ProxyType = FtpProxyType.HttpConnect;
    client.Proxy.Host = proxyHostname;
    client.Proxy.Port = proxyPort;
    
    // add proxy username and password when needed 
    client.Proxy.UserName = proxyUsername;
    client.Proxy.Password = proxyPassword;
    
    // connect, login 
    client.Connect(hostname, port);
    client.Login(username, password);
    
    // do some work 
    // ... 
    
    // disconnect 
    client.Disconnect();
    

提交回复
热议问题