samedi 30 avril 2016

Ho do i call the next proxy from a textbox instead of using random next?

Hello I have a question about calling a proxy from a textbox in c# webclient. Right now I am able to get a random next proxy from a textbox but i would like to call the second proxy every time I made a request instead of random.

The code I'm using now is :

readonly List<string> proxies = new List<string>();

WebProxy RandomProxy
    {
        get
        {
            return proxies.Count == 0 ?
                null :
                new WebProxy(proxies[rnd.Next(proxies.Count)]);

        }
    }

proxies.Clear();
proxies.AddRange(txtProxy.Lines.Where(p => !String.IsNullOrWhiteSpace(p)));

var proxy = RandomProxy;
var wc = new WebClient { Proxy = proxy };

After analyzing the request I've noticed that the proxies are changing but not how I would like to have the proxies called. So every request using the next proxy from the textbox.

Any one here who could explain to me how to change that? Thanks in advance. Regards, Dennis




Aucun commentaire:

Enregistrer un commentaire