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  https://someserver as an argument to this code:

using System;
using System.Net;
public class Test {
public static void Main(string[] args)     {

IWebProxy iwp20 = WebRequest.DefaultWebProxy;
Console.WriteLine(iwp20.GetProxy(new Uri(args[0])).ToString());
HttpWebRequest aReq = HttpWebRequest.Create(args[0])as HttpWebRequest;
Console.WriteLine(aReq.Proxy.GetProxy(new Uri(args[0])));

It does not!  It returns http://proxy:8080.

This is a problem with the 2.0 framework.  Thankfully it HAS been fixed in the 4.0 framework!

An alternative is to code the https proxy information in the code or set in in the application .config file.

Let me know if you found this Blog entry useful!