+1 vote

Hi Team,

This is Sanjiv, evaluating tool to purchase if fit for my requirement.
I am trying to read mail from Gmail with my company proxy in C# with below code :

 ProxyFactory factory = new ProxyFactory();
 IProxyClient proxy = factory.CreateProxy(
      ProxyType.Http, 
      "proxyAddress", 80, 
      "user","pass");

 Socket socket = proxy.Connect(
      "imap.gmail.com", 
      Imap.DefaultSSLPort);

It throw an error:

"Proxy responded with a 403 code - Tunnel or SSL Forbidden.
HTTP/1.0 403 Tunnel or SSL Forbidden
Date: Thu, 07 Jul 2016 05:05:22 GMT
Connection: close
Via: 1.1 localhost.localdomain"

However the same proxy working well in browser.
Can you guide me where I am wrong.

by

1 Answer

0 votes
 
Best answer

The error raised by your proxy server is clear. It doesn't like tunneling or SSL encryption.

Can you try if it allows non-SSL/TLS traffic? Here's the sample for plain port SMTP connection:

ProxyFactory factory = new ProxyFactory();
IProxyClient proxy = factory.CreateProxy(
    ProxyType.Http, 
    "proxyAddress", 80, 
    "user","pass");
Socket socket = proxy.Connect("smtp.gmail.com", Smtp.DefaultPort);

If it also throws it means that your proxy only supports web traffic (HTTP and HTTPS) and all other protocols are disabled.

by (297k points)
selected by
...