470,614 Members | 1,548 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,614 developers. It's quick & easy.

WebProxy + SSL

Hi, all

I have a problem of the following kind.

There's a remote server that can be accessed via HTTPS (say,
https://remoteserver). This server doesn't allow anonymous users, so I have
to connect to it using some username/password.

There's a .NET client that must access this remote server and this client
can go to the Internet only through Proxy Server. This Proxy Server doesn't
require authentication.

And now what happens: .Net client doesn't work properlym receiving
401-Unauthorized while trying to connect to remote server.


1. Running IE from the same client machine (and using the same Proxy
Server), user can connect to remote server just fine
2. If .NET client is configured to bypass proxy server, it can connect to
remote server just fine
3. .NET client can connect (via Proxy Server) to the same remote server via
4. .NET client can connect (via Proxy Server) to any other https site if it
allows anonymous access.

Taking above into account, it seems that the problem is with passing the
credentials through Proxy Server. Does anyone have ideas?

Now here's the code:

string url = "https://remoteserver";
string proxyurl = "some.proxyserver.url:8080";
NetworkCredential c = new NetworkCredential("user", "password", "domain");
WebProxy p = new WebProxy(proxyurl, false);
p.Credentials = CredentialCache.DefaultCredentials;
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.Proxy = p;
req.Credentials = c;
req.PreAuthenticate = true;
req.KeepAlive = true;
using(HttpWebResponse resp = (HttpWebResponse)req.GetResponse())
catch(Exception ex)

May 8 '06 #1
0 966

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jim Douglas | last post: by
2 posts views Thread by Ricardo Luceac | last post: by
4 posts views Thread by vooose | last post: by
2 posts views Thread by Sam Santiago | last post: by
reply views Thread by Michael S. Scherotter | last post: by
4 posts views Thread by Andrew | last post: by
3 posts views Thread by =?Utf-8?B?TXJOb2JvZHk=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.