S
S
Sergey Druzhko2017-09-28 19:23:34
Computer networks
Sergey Druzhko, 2017-09-28 19:23:34

Why isn't the second C# + xNet request running?

public static string Check(string login, string password, int proxyIndex)
        {
            try
            {
                using (var request = new HttpRequest())
                {
                    HttpResponse response;
                    string strResponse;

                    request.Proxy = Helper.GetProxy(proxyIndex); //Беру прокси
                    request.Cookies = new CookieDictionary();
                    request.UserAgent = HttpHelper.RandomUserAgent();

                    response = request.Post("https://www.example.com/users/login", "data[User][email]=" + login + "&data[User][password]=" + password); //Выполняю первый запрос на авторизацию, он работает
                    response = request.Get("https://www.example.com/wallets"); //из-за неизвестных мне причин эта строка не работает

                    strResponse = response.ToString();

                    if (strResponse.Contains("Minimum deposit is 0.00100 BTC"))
                    {
                        return "good account";  
                    }
                    else if (strResponse.Contains("Your IP address is temporarily banned"))
                    {
                        return "bad proxy";
                    }
                    else if (strResponse.Contains("Incorrect Password."))
                    {
                        return "bad account";  
                    }
                    else
                    {
                        return "bad account";
                    }

                }          
            } 
            catch (Exception)
            {
                return "bad proxy";
            }
        }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Eremin, 2017-09-28
@EreminD

"doesn't work" is not a very clear diagnosis for a developer.
The request is not executed at all? Is an exception thrown?
I would do this:

  1. Debug would have reached the moment response = request.Post(...)
  2. Fulfill this request
  3. Look at the response variable
  4. If everything is successful, I would look at request.Cookies (I suspect something should be written there ??)
  5. Let's go and watch the execution of the request.Get(...) line of code
  6. After execution, we again look at the response variable. Message body and headers - it should be clear from them what is wrong with the request (if there is a problem with the request)

Z
Zakharov Alexander, 2017-09-29
@AlexZaharow

C#, like any browser, has a restriction on the simultaneous connection to one site. Have a look at this post: https://stackoverflow.com/questions/1361771/max-nu...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question