.NET 2.0 HttpWebRequest does not use the https Proxy from Internet Explorer Settings

The .NET framework version 2.0 has the ability to get the IE proxy Settings and use them when making a WebRequest.  However it only will read the http static proxy and not use the https value when specified.  See this example: I would expect this code to return http://secureproxy:8080 for the proxy when I specify …

2

How to get a dump for a System.Net.WebException using DebugDiag (Debug Diagnostics)

This information is available in the help file as well.  For more options please refer to the Help Documentation include with DebugDiag. Install the latest Debug Diagnostics from http://download.microsoft.com (search for Debug Diagnostics once on that site) Configure a crash rule for all w3wp.exe processes (if this dialog does not appear simply press the ‘Add…

0

Understanding MaxServicePointIdleTime and DefaultConnectionLimit

To understand these settings you need to understand how the HttpWebRequest class relates to the ServicePointManager and ServicePoint classes.  When you make a request with the HttpWebRequest class, the ServicePointManager provides a ServicePoint object to the HttpWebRequest object to handle the connection to a web resource (web server).  This ServicePoint object manages all the requests…

13

HttpWebRequest exception: "Unable to connect to the remote server" when using .INS config files

Problem  Taking a System.Net Trace (see My Favorite System.Net Tracing File) you will see that the HttpWebRequest is trying to use a .INS file. System.Net Verbose: 0 : [0371] WebRequest::Create(http://myserver/ie/update/windows/IEConfig.INS) It is successfully retrieved but when the request is made you see something similar to this in the .NET log: System.Net.Sockets Error: 0 : [0371]…

3

My Favorite System.Net trace configuration file dumps Process ID and Date Time Information

Often you need to correlate a .NET trace with a Netmon trace.  To do that you need the date and time of the call from the System.Net trace.  This will do it! NOTE:  This section is configures where the log file is and where it should be written: initializeData="System.Net.trace.log" Specify the path and file name…

3

HttpWebRequest WebExcepton: The remote server returned an error: (407) Proxy Authentication Required.

Problem System.Net Tracing (see My Favorite System.Net Tracing File) revealed that we are getting the 407 error and the .NET framework is not retrying the request with Credentials.  System.Net Error: 0 : [4811] Exception in the HttpWebRequest#33574938:: – The remote server returned an error: (407) Proxy Authentication Required.  We can see in a Fiddler2 trace that…

7

Anaylyze HttpWebRequest Hangs with a VB DebugDiag script`

Here is a VB Version of the JScript DebugDiag script for analyzing WebRequest hangs using DebugDiag http://blogs.msdn.com/jpsanders/archive/2008/10/24/analyzing-httpwebrequest-connection-saturation-in-net.aspx.  It has several improvements over the previous version.  First you will notice many similarities to the previous script.  Some minor changes were added to translate from Jscript to VBscript.  One big change is the .loadby command.  This will…

0

Using .NET HttpWebRequest class with SiteMinder you get a 403 or 401 error

Download Fiddler from http://fiddlertool.com and run this for an Internet Explorer browser session that successfully connects.   Then hit the same site with your .NET 2.0 client application and make sure you set the credentials in your code as well: http://msdn.microsoft.com/en-us/library/system.net.networkcredential.aspx  (Note you can set myCreds directly on the Credentials property of the HttpWebRequest object……

0

The underlying connection was closed: An unexpected error occurred on a receive.

This article is a great help http://support.microsoft.com/kb/915599 however, there is another potential cause.  If the target server resets the connection without replying with an HTTP status (for example 200 OK) you can also get this error.  Solution, find out why the server is reseting the connection.  Common causes include the target of the HTTP traffic is…

0