【发布时间】:2023-03-09 12:58:01
【问题描述】:
所以我用它来加载一个网站 :
WebClient webClient = new WebClient();
webClient.Encoding = Encoding.UTF8;
string str2 = webClient.DownloadString(url);
if (Program.proxies.Count > 0)
{
string Address = Program.proxies[new Random().Next(0, Program.proxies.Count)];
string[] strArray = Address.Split(':');
if (strArray.Length > 2)
webClient.Proxy = (IWebProxy)new WebProxy(strArray[0] + ":" + strArray[1])
{
Credentials = (ICredentials)new NetworkCredential(strArray[2], strArray[3])
};
else
webClient.Proxy = (IWebProxy)new WebProxy(Address);
}
return str2.Replace("'", "'");
}
catch (Exception ex1)
{
try
{
using (StreamWriter streamWriter = System.IO.File.AppendText("log.txt"))
streamWriter.WriteLine("[" + DateTime.Now.ToString() + "] " + ex1.Message);
str1 = "";
}
catch (Exception ex2)
{
str1 = "";
}
}
我得到无效的 URI:无法在日志中解析主机名,以前可以工作,我添加了一个 windows 窗体,现在我不能让它像以前那样工作......而且像个笨蛋。 .. 我删除了我的旧项目
【问题讨论】:
-
什么是
Program.proxies?url是什么?
标签: c# web uri invalidation