Example #1
0
 private static void SetProxy(WebRequest request)
 {
     if (proxyConfiguration != null)
     {
         WebProxy webProxy = new WebProxy(new Uri(proxyConfiguration.GetScheme()
                                                  + "://"
                                                  + proxyConfiguration.GetHost()
                                                  + ":"
                                                  + proxyConfiguration.GetPort()));
         if (proxyConfiguration.HasCredentials())
         {
             webProxy.Credentials = new NetworkCredential(proxyConfiguration.GetUserName(),
                                                          proxyConfiguration.GetPassword());
         }
         request.Proxy = webProxy;
     }
 }