Problem with HTTPS and Proxy Servers using Net Framework 1.1

D

dzc55g

Problem: Attempting to return https web page via a proxy server not working in .NE

Platform: Windows 2000 SP4, Visual Studio .NET 2003, .NET Framework 1.

The following code returns

An unhandled exception of type 'System.Net.WebException' occurred in system.dl

Additional information: The underlying connection was closed: Unable to connect to the remote server

Code

HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create("https://webaddress.com")

WebProxy wp = new WebProxy("proxyaddress", 443);

wp.Credentials = new NetworkCredential("username","password")
HttpWReq.Proxy = wp

// Turn off connection keep-alives
HttpWReq.KeepAlive = false

HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse()

The code above seems to work fine on the following configuration

Windows XP, .NET Framework 1.
Windows 2000 SP3, .NET Framework 1.

However it does not work on

Windows XP, .NET Framework 1.

If I change the code to request a standard http page (e.g. http://google.co.uk) and change the port number to 80 the code works fine

Is there some version or security issue I am not aware of
Is this a known issue with 1.1 of the .NET Framework
Is there an alternative method in .NET
 
P

Paul Glavich [MVP - ASP.NET]

I've only seen this happen when Keep-alives are used. I can see in the code
you are disabling this but have you checked the Http headers to verify this
is the case. Also, try disabling them on the server.


--
- Paul Glavich
Microsoft MVP - ASP.NET


dzc55g said:
Problem: Attempting to return https web page via a proxy server not working in .NET

Platform: Windows 2000 SP4, Visual Studio .NET 2003, .NET Framework 1.1

The following code returns:

An unhandled exception of type 'System.Net.WebException' occurred in system.dll

Additional information: The underlying connection was closed: Unable to connect to the remote server.

Code:

HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create("https://webaddress.com");

WebProxy wp = new WebProxy("proxyaddress", 443);

wp.Credentials = new NetworkCredential("username","password");
HttpWReq.Proxy = wp;

// Turn off connection keep-alives.
HttpWReq.KeepAlive = false;

HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();

The code above seems to work fine on the following configurations

Windows XP, .NET Framework 1.0
Windows 2000 SP3, .NET Framework 1.0

However it does not work on

Windows XP, .NET Framework 1.1

If I change the code to request a standard http page (e.g.
http://google.co.uk) and change the port number to 80 the code works fine.
 
F

Feroze [MSFT]

What kind of proxy server do you have ? Is it a HTTP proxy ?

If you are just using a http proxy to tunnel HTTPS request, then you should
just set

WebProxy wp = new WebProxy("proxyaddress", 80)

instead of

WebProxy wp = new WebProxy("proxyaddress", 443)


--
feroze
http://weblogs.asp.net/feroze_daud
============

Remove "user" from the email address to reply to the author.

This posting is provided "AS IS" with no warranties, and confers no rights

Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm




dzc55g said:
Problem: Attempting to return https web page via a proxy server not working in .NET

Platform: Windows 2000 SP4, Visual Studio .NET 2003, .NET Framework 1.1

The following code returns:

An unhandled exception of type 'System.Net.WebException' occurred in system.dll

Additional information: The underlying connection was closed: Unable to connect to the remote server.

Code:

HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create("https://webaddress.com");

WebProxy wp = new WebProxy("proxyaddress", 443);

wp.Credentials = new NetworkCredential("username","password");
HttpWReq.Proxy = wp;

// Turn off connection keep-alives.
HttpWReq.KeepAlive = false;

HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();

The code above seems to work fine on the following configurations

Windows XP, .NET Framework 1.0
Windows 2000 SP3, .NET Framework 1.0

However it does not work on

Windows XP, .NET Framework 1.1

If I change the code to request a standard http page (e.g.
http://google.co.uk) and change the port number to 80 the code works fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top