Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 534683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:38:17+00:00 2026-05-13T09:38:17+00:00

Okay I need help, again! For some reason it is not working, no idea

  • 0

Okay I need help, again! For some reason it is not working, no idea why.. nothing even appears on my catch request..

public void load(object sender, DoWorkEventArgs e)
    {
        int repeat = 1;
        int proxyIndex = 1;
        if (listBox1.Items.Count == proxyIndex) //If we're at the end of the proxy list
        {
            proxyIndex = 0; //Make the selected item the first item in the list
        }
        try
        {
            int i = 0;
            while (i < listBox1.Items.Count)
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(textBox1.Text);
                string proxy = listBox1.Items[1].ToString();
                string[] proxyArray = proxy.Split(':');
                WebProxy proxyz = new WebProxy(proxyArray[0], int.Parse(proxyArray[1]));
                request.Proxy = proxyz;
                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                {
                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                    {
                        string str = reader.ReadToEnd();
                    }
                }

                    /*HttpWebRequest request = (HttpWebRequest)WebRequest.Create(textBox1.Text);
                    string proxy = listBox1.Items[i].ToString();
                    string[] proxyArray = proxy.Split(':');
                    WebProxy proxyz = new WebProxy(proxyArray[0], int.Parse(proxyArray[1]));
                    request.Proxy = proxyz;
                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                    StreamReader reader = new StreamReader(response.GetResponseStream());
                    string str = reader.ReadToEnd();
                    Thread.Sleep(100);
                    {
                        if (str != null)
                        {
                            listBox2.Items.Add("Starting connection.");
                            Thread.Sleep(1000);
                            {
                                listBox2.Items.Add("Waiting..");
                                Thread.Sleep(500);
                                {
                                    listBox2.Items.Add("Connection closed.");
                                    repeat++;
                                    continue;
                                }
                            }
                        }
                        else if (str == null)
                        {
                            listBox2.Items.Add("Reply was null, moving on.");
                            proxyIndex++;
                            repeat++;
                        }
                    }
                     */
                }
            }
        catch (Exception ex) //Incase some exception happens
        {
            MessageBox.Show(ex.Message);
            return;
            // listBox2.Items.Add("Error:" + ex.Message);
        }
    }

How can I get it to work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:38:18+00:00Added an answer on May 13, 2026 at 9:38 am

    It looks like you’re trying to use a BackgroundWorker to perform this operation, and in the absence of any more detailed information on what isn’t working, I’d guess it’s because you aren’t assigning any result or errors which can be picked up by main thread.

    You should assign the results of the request in the case of success:

    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
    {
        e.Result = reader.ReadToEnd();
    }
    

    Since you seem to be making multiple requests you should probably make the result a List<string> or similar.

    You should remove the try/catch block and deal with any errors in the RunWorkerCompleted event of the BackgroundWorker:

    private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
    {
        if(e.Error != null)
        {
            MessageBox.Show("Error in async operation: " + ex.Message);
        }
        else
        {
            //process results
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.