472,958 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

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.

However:

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
http.
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");
try
{
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())
{
Console.WriteLine(resp.StatusCode);
}
}
catch(Exception ex)
{
Console.WriteLine(ex);
}

May 8 '06 #1
0 1137

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jim Douglas | last post by:
I have a requirement to dynamically create a webProxy object in C#. I have created an instance of the webProxy and stored it within a hashtable then placing the hashtable in cache. When required I...
2
by: Ricardo Luceac | last post by:
I need to use a Proxy to use a webrequest object, but the proxy is not a URI, is a ip address and a port number... How can I create the WebProxy object??? Or use the proxy in other way??? ...
4
by: vooose | last post by:
Consider accessing a webpage through a proxy server: WebRequest request = WebRequest.Create("http://somepage.com"); WebProxy proxy = new WebProxy(proxyHost, proxyPort); proxy.Credentials = new...
2
by: Sam Santiago | last post by:
I am using the WebProxy.GetDefaultProxy() function to read the IE settings, but it's returning an empty WebProxy object. Are there any known reasons why this is not reading the proxy settings in IE...
0
by: Michael S. Scherotter | last post by:
I am building a C# desktop application in .Net 1.1 that consumes web services. I use System.Net.WebProxy.GetDefaultProxy() to get the proxy settings from IE but I get reports from people who are...
4
by: Andrew | last post by:
Morning everybody, I have an XML document located on a web address and I wish to create a C# program to read that XML document and process it - which shouldn't be that difficult yet I'm running...
3
by: John A Grandy | last post by:
I am always RAS'd into MS CorpNet VPN under my REDMOND account. I am always able to ping "itgproxy.redmond.corp.microsoft.com" I instantiate a System.Net.WebProxy object as follows: using...
7
by: djc | last post by:
I see many ways to accomplish setting up proxy settings for a web request in the documentation but many of them are marked as obsolete. 1) What is the current and correct way to tell all my...
3
by: =?Utf-8?B?TXJOb2JvZHk=?= | last post by:
I found an example online and when I tried repeating it with the proxy I normally use for my browser, I get errors. What I do is this: WebProxy proxy = new...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.