return null;\r
} else {\r
// host:portが設定されているならば、それをもとに設定\r
- return new WebProxy(pref.ProxyAddress);\r
+ WebProxy proxy = new WebProxy(pref.ProxyAddress);\r
+ \r
+ // 認証プロキシの場合、認証情報を付加する\r
+ try {\r
+ Uri uri = new Uri(pref.ProxyAddress);\r
+ if (! string.IsNullOrEmpty(uri.UserInfo)) {\r
+ int pos = uri.UserInfo.IndexOf(':');\r
+ if (pos >= 0) {\r
+ proxy.Credentials = new NetworkCredential(\r
+ uri.UserInfo.Substring(0, pos),\r
+ uri.UserInfo.Substring(pos+1)\r
+ );\r
+ }\r
+ }\r
+ } catch (Exception) {\r
+ }\r
+ \r
+ return proxy;\r
}\r
}\r
}\r