fixed #1523: Handle proxy issues

This commit is contained in:
Jaex 2016-04-29 01:16:11 +03:00
parent 952320fc9f
commit 5f72b2adab

View file

@ -66,11 +66,18 @@ public bool IsValidProxy()
public IWebProxy GetWebProxy()
{
if (IsValidProxy())
try
{
NetworkCredential credentials = new NetworkCredential(Username, Password);
string address = string.Format("{0}:{1}", Host, Port);
return new WebProxy(address, true, null, credentials);
if (IsValidProxy())
{
NetworkCredential credentials = new NetworkCredential(Username, Password);
string address = string.Format("{0}:{1}", Host, Port);
return new WebProxy(address, true, null, credentials);
}
}
catch (Exception e)
{
DebugHelper.WriteException(e, "GetWebProxy failed");
}
return null;