473,414 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 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 1173

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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.