Question:
Hi,
I have to connect to a FTP server through a (HTTP) Proxy, but unfortunately it's not working. When I use Internet Explorer it's working correctly, specifying a proxy in IE with no username or password. But in Chilkat I keep getting 'Access Denied' errors.
Can anyone help me with this?
Here's a portion of my C# Code:
Chilkat.Ftp2 ftp = new Chilkat.Ftp2();
ftp.HttpProxyHostname = "gprsproxy.ram.nl";
ftp.HttpProxyPort = 5000;
ftp.HttpProxyUsername = String.Empty;
ftp.HttpProxyPassword = String.Empty;
ftp.HttpProxyAuthMethod = "NTLM";
ftp.Hostname = "MyFTPServer";
ftp.Port = 21;
ftp.Username = "MyUsername";
ftp.Password = "MyPassword";
ftp.VerboseLogging = true;
ftp.Connect();
And the errorlog:
[FTP] Connect Error: ChilkatLog:
Connect_Ftp2:
DllDate: Aug 15 2013
ChilkatVersion: 9.4.1.42
UnlockPrefix: MAGICHFTP
Username: PROMISAPP3:g.termors
Architecture: Little Endian; 32-bit
Language: .NET 2.0
VerboseLogging: 1
ProgressMonitoring:
enabled: yes
heartbeatMs: 0
sendBufferSize: 65536
--ProgressMonitoring
ImplicitSsl: 0
AuthTls: 0
AuthSsl: 0
Hostname: 62.58.196.52
Port: 21
IdleTimeoutMs: 60000
ConnectTimeout: 60
HttpProxyConnect:
proxyHostname: gprsproxy.ram.nl
proxyPort: 5000
proxyAuthMethod: NTLM
ConnectTimeoutMs_1: 60000
calling ConnectSocket2
IPV6 enabled connect with NO heartbeat.
connectingTo: gprsproxy.ram.nl
resolveHostname1:
Resolving domain name (IPV4) via gethostbyname
--resolveHostname1
GetHostByNameHB_ipv4: Elapsed time: 15 millisec
myIP_1: 192.168.115.136
myPort_1: 58496
connect successful (1)
ConnectRequest: CONNECT 62.58.196.52:21 HTTP/1.1
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Host: 62.58.196.52
ConnectResponseHeader: HTTP/1.0 403 Forbidden
Server: squid/3.0.STABLE23
Mime-Version: 1.0
Date: Tue, 25 Feb 2014 15:15:53 GMT
Content-Type: text/html
Content-Length: 1436
X-Squid-Error: ERR_ACCESS_DENIED 0
X-Cache: MISS from proxy-mobiles.ram.nl
X-Cache-Lookup: NONE from proxy-mobiles.ram.nl:5000
Via: 1.0 proxy-mobiles.ram.nl (squid/3.0.STABLE23)
Proxy-Connection: close
firstLine: HTTP/1.0 403 Forbidden
--HttpProxyConnect
Turning on TCP_NODELAY.
socketOptions:
SO_SNDBUF: 8192
SO_RCVBUF: 8192
TCP_NODELAY: 1
--socketOptions
readFtpControlChannelReply:
rcvUntilMatchStringQP: =0A
dbReceived0:
startIdx: 0
dbReceived: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/htm=
l4/strict.dtd">=0A<html><head>=0A<meta http-equiv=3D"Content-Type" content=
=3D"text/html; charset=3Diso-8859-1">=0A<title>ERROR: The requested URL cou=
ld not be retrieved</title>=0A<style type=3D"text/css"><!--BODY{background-=
color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}-->=
</style>=0A</head><body>=0A<h1>ERROR</h1>=0A<h2>The requested URL could not=
be retrieved</h2>=0A<hr>=0A<p>The following error was encountered while tr=
ying to retrieve the URL: <a href=3D"62.58.196.52:21">62.58.196.52:21</a></=
p>=0A=0A<blockquote>=0A<p><b>Access Denied.</b></p>=0A</blockquote>=0A=0A<p=
>Access control configuration prevents your request from being allowed at t=
his time. Please contact your service provider if you feel this is incorre=
ct.</p>=0A=0A<p>Your cache administrator is <a href=3D"mailto:webmaster?sub=
ject=3DCacheErrorInfo%20-%20ERR_ACCESS_DENIED&body=3DCacheHost%3A%20pro=
xy-mobiles.ram.nl%0D%0AErrPage%3A%20ERR_ACCESS_DENIED%0D%0AErr%3A%20%5Bnone=
%5D%0D%0ATimeStamp%3A%20Tue,%2025%20Feb%202014%2015%3A15%3A53%20GMT%0D%0A%0=
D%0AClientIP%3A%20192.168.115.136%0D%0A%0D%0AHTTP%20Request%3A%0D%0ACONNECT=
%20%2F%20HTTP%2F1.1%0AConnection%3A%20Keep-Alive%0D%0AProxy-Connection%3A%2=
0Keep-Alive%0D%0AHost%3A%2062.58.196.52%0D%0A%0D%0A%0D%0A">webmaster</a>.</=
p>=0A=0A<br>=0A<hr>=0A<div id=3D"footer">Generated Tue, 25 Feb 2014 15:15:5=
3 GMT by proxy-mobiles.ram.nl (squid/3.0.STABLE23)</div>=0A</body></html>=
=0A
Found match string.
Questionable FTP reply received.
FtpReply: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
--readFtpControlChannelReply
initialStatus: -1
initialResponse: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Failed to connect to FTP server.
Failed.
--Connect_Ftp2
--ChilkatLog
Please test using this new build:
32-bit: http://www.chilkatsoft.com/preRelease/ChilkatDotNet2-9.5.0-win32.zip
64-bit: http://www.chilkatsoft.com/preRelease/ChilkatDotNet2-9.5.0-x64.zip
Unfortunately still no luck with pre release 9.5.0.
I tried every combination of proxy settings, passive/active etc, but still no luck. The only change I see is that before I got a connect error code 200, and now with the new version it's 0.
Here's the lastest log:
[FTP] Connect Error: ChilkatLog:
Connect_Ftp2:
DllDate: Feb 26 2014
ChilkatVersion: 9.5.0.14
UnlockPrefix: MAGICHFTP
Username: PROMISAPP3:g.termors
Architecture: Little Endian; 32-bit
Language: .NET 2.0
VerboseLogging: 1
ProgressMonitoring:
enabled: yes
heartbeatMs: 0
sendBufferSize: 65536
--ProgressMonitoring
ImplicitSsl: 0
AuthTls: 0
AuthSsl: 0
Hostname: 62.58.196.52
Port: 21
IdleTimeoutMs: 60000
ConnectTimeout: 60
httpProxyConnect:
proxyHostname: gprsproxy.ram.nl
proxyPort: 5000
proxyAuthMethod: NTLM
connectSocket:
domainOrIpAddress: gprsproxy.ram.nl
port: 5000
connectTimeoutMs: 60000
connect_ipv6_or_ipv4:
Multi-threaded domain to IP address resolution
AddrInfoList:
AddrInfo:
ai_flags: 0
ai_family: 2
ai_socktype: 0
ai_protocol: 0
ai_addrlen: 16
ai_canonname: (NULL)
--AddrInfo
--AddrInfoList
connecting to IPV4 address...
ipAddress: 89.221.178.149
connect:
Waiting for the connect to complete...
myIP: 192.168.115.136
myPort: 51081
socket connect successful.
--connect
--connect_ipv6_or_ipv4
--connectSocket
connectRequest: CONNECT 62.58.196.52:21 HTTP/1.1
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Host: 62.58.196.52
connectResponseHeader: HTTP/1.0 403 Forbidden
Server: squid/3.0.STABLE23
Mime-Version: 1.0
Date: Thu, 27 Feb 2014 08:44:10 GMT
Content-Type: text/html
Content-Length: 1436
X-Squid-Error: ERR_ACCESS_DENIED 0
X-Cache: MISS from proxy-mobiles.ram.nl
X-Cache-Lookup: NONE from proxy-mobiles.ram.nl:5000
Via: 1.0 proxy-mobiles.ram.nl (squid/3.0.STABLE23)
Proxy-Connection: close
firstLine: HTTP/1.0 403 Forbidden
Non-success CONNECT response.
firstResponseLine: HTTP/1.0 403 Forbidden
--httpProxyConnect
ConnectFailReason: 0
Failed to connect to FTP server.
Failed.
--Connect_Ftp2
--ChilkatLog
An HTTP request that requires proxy authentication would receive a 407 response, not a 403 response:
407 Status Code Explained (quoted from http://100pulse.com/http-statuscode/407.jsp)
This code is similar to 401 (Unauthorized), but indicates that the client must first authenticate itself with the proxy. The proxy MUST return a Proxy-Authenticate header field containing a challenge applicable to the proxy for the requested resource. The client MAY repeat the request with a suitable Proxy-Authorization header field.
When Chilkat receives the 407 response, it will automatically re-send the request with the appropriate Proxy-Authenticate header, using the authentication method as specified by the server.
A 403 error response indicates some other access error. See this: http://en.wikipedia.org/wiki/HTTP_403