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
Paul Glavich [MVP - ASP.NET] - 04 May 2004 13:52 GMT
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
> Problem: Attempting to return https web page via a proxy server not working in .NET
>
[quoted text clipped - 34 lines]
> Is this a known issue with 1.1 of the .NET Framework.
> Is there an alternative method in .NET?
Feroze [MSFT] - 11 May 2004 01:22 GMT
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)

Signature
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
> Problem: Attempting to return https web page via a proxy server not working in .NET
>
[quoted text clipped - 34 lines]
> Is this a known issue with 1.1 of the .NET Framework.
> Is there an alternative method in .NET?