Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
28.9k views
in .NET FTP by (440 points)
I am getting the following error message when I try connecting to an FTP server using an Http proxy:

13 Answers

0 votes
by (161k points)
It looks like the ProxySettings property hasn't been set.
0 votes
by (440 points)
Here's my code where I set the ProxySettings. I am using the same proxy settings that I use in the GUI, but for some reason, this doesn't work.

public void SetFtpProxyServer(ProxyServerRow proxy)
{
if(proxy != null)
{
if (proxy.Type == ProxyType.Socks5)
{
Socks5Context socks = new Socks5Context(proxy.Address, proxy.Port);
socks.AuthMethods.Add(new Socks5UserNamePasswordAuthMethod(proxy.Username, proxy.Password));
ftpConnection.SocksProxySettings = socks;
}
else if (proxy.Type == ProxyType.Http)
{
ProxySettings proxySettings = new ProxySettings();
proxySettings.ProxyType = EnterpriseDT.Net.Proxy.ProxyType.Http;
proxySettings.ProxyAddress = proxy.Address;
proxySettings.ProxyPort = proxy.Port;
proxySettings.UserName = proxy.Username;
proxySettings.Password = proxy.Password;
proxySettings.NullAuthenticationEnabled = false;
proxySettings.PasswordAuthenticationEnabled = false;
}
}
}
0 votes
by (440 points)
I just saw what I was doing wrong. I was missing the folllowing line:
ftpConnection.ProxySettings = proxySettings;

Thanks for the help!

I have another question:

When I connect to an ftp server using http proxy settings, it takes an extremely long time to connect (20 - 30 seconds), and also each subsequent ListDirectory action takes just as long. But when I connect to the same server using Filezilla, and going through the same proxy server, the connection is very fast. Almost instantaneous.

My question is: what is the reason that edtFTPNet/PRO proxy connections take such a long time to connect and get directory listings?

Thanks again,

Gohar
0 votes
by (161k points)
Please email us the log file set to All level - we should then be able to see where the time delays are.
0 votes
by (440 points)
Here is my log file.
(Sorry for the long text... I didn't find a way to attach the file to the post instead of cutting and pasting).

--------------------------------------------------------------------------------------------------------------------------

DEBUG [SFTPMessageStore] 19 Mar 2008 15:51:04.596 : Set timeout=1200000
INFO [LicenseProperties] 19 Mar 2008 15:51:04.596 : Licence expiry date: 12/31/9999
INFO [LicenseProperties] 19 Mar 2008 15:51:04.596 : Production license
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : Invoking delegate EnterpriseDT.Net.Ftp.FTPDirectoryEventHandler -> Thomson.Atg.Midas.Ipa.FileTransport.EdtFtpTransport.ftpConnection_LocalDirectoryChanging
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : Finding MainWindowHandle
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : MainWindowHandle found
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : No GUI control
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : Invoking delegate dynamically
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : Dynamic delegate invocation complete
DEBUG [FTPConnection] 19 Mar 2008 15:51:04.611 : Set LocalDirectory='C:\Users\Gharibg\Documents\Midas Source Control\IPA\MidasFileTransport\EdtFTP Test\bin\Debug'
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : Invoking delegate EnterpriseDT.Net.Ftp.FTPDirectoryEventHandler -> Thomson.Atg.Midas.Ipa.FileTransport.EdtFtpTransport.ftpConnection_LocalDirectoryChanged
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : No GUI control
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : Invoking delegate dynamically
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : Dynamic delegate invocation complete
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : Invoking delegate EnterpriseDT.Net.Ftp.FTPConnectionEventHandler -> Thomson.Atg.Midas.Ipa.FileTransport.EdtFtpTransport.ftpConnection_Connecting
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : No GUI control
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : Invoking delegate dynamically
ALL [FTPConnection] 19 Mar 2008 15:51:04.611 : Dynamic delegate invocation complete
INFO [LicenseProperties] 19 Mar 2008 15:51:04.611 : Licence expiry date: 12/31/9999
INFO [LicenseProperties] 19 Mar 2008 15:51:04.611 : Production license
DEBUG [SSLFTPClient] 19 Mar 2008 15:51:04.611 : Connecting to myserver.com:21
DEBUG [HostNameResolver] 19 Mar 2008 15:51:04.877 : myserver.com resolved to xx.xx.xx.xx
DEBUG [SSLFTPControlSocket] 19 Mar 2008 15:51:04.877 : waitOnShutdownSSL=True
DEBUG [ProxyConnector] 19 Mar 2008 15:51:04.877 : ProxySettings: Http 10.15.192.56:80 (mydomain\myusername,mypassword)
DEBUG [HostNameResolver] 19 Mar 2008 15:51:04.877 : 10.15.192.56 resolved to 10.15.192.56
DEBUG [ExFTPControlSocket] 19 Mar 2008 15:51:04.877 : Connecting to proxy 10.15.192.56:80
DEBUG [ExFTPControlSocket] 19 Mar 2008 15:51:04.892 : Sending proxy connect request 74.220.207.79:21
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.892 : SetHeaderField(User-Agent,edtFTPnet)
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.892 : SetHeaderField(Pragma,No-Cache)
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.892 : SetHeaderField(Proxy-Connection,Keep-Alive)
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.892 : Reading response
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.892 : ProcessResponse: 'HTTP/1.1 407 Proxy Authentication Required'
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.892 : SetHeaderField(proxy-authenticate,NTLM)
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.892 : SetHeaderField(proxy-authenticate,BASIC realm="Thomson AM Domain")
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.892 : SetHeaderField(cache-control,no-cache)
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.892 : SetHeaderField(pragma,no-cache)
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.908 : SetHeaderField(content-type,text/html; charset=utf-8)
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.908 : SetHeaderField(proxy-connection,close)
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.908 : SetHeaderField(set-cookie,BCSI-CS0A0FC038=2; Path=/)
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.908 : SetHeaderField(connection,close)
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.908 : SetHeaderField(content-length,810)
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.908 : Proxy-Authenticate='BASIC realm="Thomson AM Domain"'
DEBUG [HttpProxyConnector] 19 Mar 2008 15:51:04.908 : realm=Thomson AM Domain, method=BASIC
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.908 : SetHeaderField(Proxy-Authorization,Basic YW1cZ2hhcmliZzpCb25qb3VyNTc5)
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.908 : Reading response
DEBUG [HttpHeader] 19 Mar 2008 15:51:04.923 : ProcessResponse: 'HTTP/1.1 200 Connection established'
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:04.923 : Setting socket timeout=1200000
DEBUG [SecureSocket] 19 Mar 2008 15:51:04.923 : Set timeout=1200000
DEBUG [SecureSocket] 19 Mar 2008 15:51:04.923 : Set timeout=1200000
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:04.923 : Command encoding=System.Text.ASCIIEncoding
DEBUG [ExFTPControlSocket] 19 Mar 2008 15:51:04.923 : Created control-socket: SocksContext=, ProxySettings=Http 10.15.192.56:80 (mydomain\myusername,mypassword), RemoteHost=74.220.207.79, controlPort=21, timeout=1200000
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:34.829 : 220---------- Welcome to Pure-FTPd [TLS] ----------
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:34.829 : 220-You are user number 4 of 50 allowed.
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:34.829 : 220-Local time is now 16:51. Server port: 21.
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:34.829 : 220-IPv6 connections are also welcome on this server.
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:34.829 : 220 You will be disconnected after 15 minutes of inactivity.
DEBUG [SecureFTPConnection] 19 Mar 2008 15:51:34.829 : Changing local working directory to C:\Users\Gharibg\Documents\Midas Source Control\IPA\MidasFileTransport\EdtFTP Test\bin\Debug
ALL [FTPConnection] 19 Mar 2008 15:51:34.829 : Invoking delegate EnterpriseDT.Net.Ftp.FTPLogInEventHandler -> Thomson.Atg.Midas.Ipa.FileTransport.EdtFtpTransport.ftpConnection_LoggingIn
ALL [FTPConnection] 19 Mar 2008 15:51:34.829 : No GUI control
ALL [FTPConnection] 19 Mar 2008 15:51:34.829 : Invoking delegate dynamically
ALL [FTPConnection] 19 Mar 2008 15:51:34.829 : Dynamic delegate invocation complete
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:34.829 : ---> USER ftpuser
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:34.875 : 331 User ftpuser OK. Password required
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:34.875 : ---> PASS ********
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:35.250 : 230-Your bandwidth usage is restricted
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:35.250 : 230-User ftpuser has group access to: ftpuser
DEBUG [FTPControlSocket] 19 Mar 2008 15:51:35.250 : 230 OK. Current restricted directory is /
DEBUG [FTPConnection] 19 Mar 2008 15:51:35.250 : Successfully logged in
ALL [FTPConnection] 19 Mar 2008 15:51:35.250 : Invoking delegate EnterpriseDT.Net.Ftp.FTPLogInEventHandler -> Thomson.Atg.Midas.Ipa.FileTransport.EdtFtpTransport.ftpConnection_LoggedIn
ALL [FTPConnection] 19 Mar 2008 15:51:35.250 : No GUI control
ALL [FTPConnection] 19 Mar 2008 15:51:35.250 : Invoking delegate dynamically
ALL [FTPConnection] 19 Mar 2008 15:51:35.250 : Dynamic delegate invocation complete
ALL [FTPConnection] 19 Mar 2008 15:51:35.250 : Invoking delegate EnterpriseDT.Net.Ftp.FTPConnectionEventHandler -> Thomson.Atg.Midas.Ipa.FileTransport.EdtFtpTransport.ftpConnection_Connected
ALL [FTPConnection] 19 Mar 2008 15:51:35.250 : No GUI control
ALL [FTPConnection] 19 Mar 2008 15:5
0 votes
by (161k points)
It looks like the problem is between the proxy server and the FTP server.

For example, for a directory listing you have:

DEBUG [FTPControlSocket] 19 Mar 2008 15:51:37.683 : ---> NLST /
DEBUG [FTPControlSocket] 19 Mar 2008 15:52:07.323 : 150 Accepted data connection

It takes 30 seconds for the response to be returned to the client, even though between the client and the proxy server it is instantaneous.

Do you get a similar delay if you use FileZilla to *download* files? Because FileZilla caches directory listings, you may not notice a delay for listings if you have visited directories before.
0 votes
by (440 points)
When I use filezilla, the initial connection (and getting directory listings) takes only a second or two. There's no delay. And when I download a file, it is instantaneous as well.
I only see the delay when using the edtFTPnet/Pro library.

One other thing to note is that in Filezilla, I'm connecting with an FTP Proxy connection (USER RemoteID@RemoteHost FireID). And when connecting with the edtFTPNet/Pro, I use HTTP proxy settings.
(Using HTTP proxies in filezilla did not work for me).
0 votes
by (161k points)
One other thing to note is that in Filezilla, I'm connecting with an FTP Proxy connection (USER RemoteID@RemoteHost FireID). And when connecting with the edtFTPNet/Pro, I use HTTP proxy settings.
(Using HTTP proxies in filezilla did not work for me).


That's why you are getting differing performances - you are using different proxy servers. Try using the FTP proxy with edtFTPnet/PRO and you should get the same performance.

HTTP proxies for FTP aren't exactly fast that we've seen.
0 votes
by (440 points)
How do I use the FTP proxy with edtFTPnet/PRO? I thought it only support SOCKS and Http proxies.
I need a way to specify the FTP proxy format. My proxy server only accepts the "USER RemoteID@RemoteHost FireID" format.
0 votes
by (440 points)
I found this paragraph in the help pages:

Many firewalls support a means of forming proxy connections other than SOCKS.

When of supplying the remote hostname, the name of the firewall is supplied instead. Instead of supplying the remote user as the user, a string is supplied in the form of remoteuser@remotehost.com. The remote password is supplied as normal.

For example:

ftpConnection.UserName = "remoteuser@remotehost.com";
ftpConnection.PassWord = "remotePassword";
ftpConnection.ServerAddress = "firewallhostname";

Firewalls we have confirmed support this syntax at the time of writing include Check Point Firewall-1 and WinProxy.


Does this method allow you to connect to ftp procy servers of type "USER RemoteID@RemoteHost FireID"?
If so, how do you specify the firewall/proxy username and password?

Thanks

Categories

...