C# Proxy Checking

325 Views Asked by At

So this code is not doing anything when Im passing a list of proxies to it. I can confirm everything else is working, just not this part. Ive done this in VB.NET but not in C# and it should be practically the same dang thang... Ideally I wanted to thread this code but even just

foreach(string s in _scrapeList)
{
     TestProxy(s);
}

That just doesnt seem to work. I have logfiles of all this self-made and this just dont make sense. https://github.com/Eric904P/ProxyGenW9 is the full project, so if anybody has some insight let me know.

private void TestProxy(string p)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://azenv.net");
            request.Proxy = new WebProxy(p);
            request.UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36";
            request.Timeout = _timeOut;
            try
            {
                SaveLogLine("proxy: " + p + " " + request.GetResponse().GetResponseStream().ToString());
                using (StreamReader sr = new StreamReader(request.GetResponse().GetResponseStream()))
                {
                    if (sr.ReadToEnd().Contains("azenv.net"))
                    {
                        SaveLogLine("Working proxy: " + p);
                        //lock (_listLock)
                        //{
                            _proxyList.Add(p);
                            textBox1.AppendText(p + Environment.NewLine);
                        //}
                    }
                }
            }
            catch (Exception e)
            {
                SaveLogLine("CheckProx_Error " + "Proxy: " + p + Environment.NewLine + e);
            }
        }
0

There are 0 best solutions below