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 576059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:00:25+00:00 2026-05-13T14:00:25+00:00

this is my implementation of Webclient, supposedly, this download should be continuous, but for

  • 0

this is my implementation of Webclient, supposedly, this download should be continuous, but for some reason, which debug don’t even help, i got 1 success in the first run, then the rest are failed. Does anyone know why ?

        for (int i = 1; i <= Count; i++)
        {
            using (WebClient wc = new WebClient())
            {

                wc.Headers["Accept-Encoding"] = "gzip";
                wc.Headers["User-Agent"] = "Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0) (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
                byte[] arr = wc.DownloadData(url);

                if (arr.Length > 0)
                    Console.WriteLine(i.ToString() + ": SUCCESS");
                else
                    Console.WriteLine(i.ToString() + ": FAILED");
            }

        }
  • 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-13T14:00:26+00:00Added an answer on May 13, 2026 at 2:00 pm

    when i messed up with this code, it work, LOL! I dont’ know what to say anymore…

                    using (WebClient client = new WebClient())
                    {
                        //manipulate request headers (optional)
                        client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
    
                        //execute request and read response as string to console
                        using (StreamReader reader = new StreamReader(client.OpenRead(url)))
                        {
                            string s = reader.ReadToEnd();
                            //Console.WriteLine(s);
                            Console.WriteLine("Vote " + i.ToString() + ": SUCCESS");
                            i++;
                        }
                    }
    
                    // *** Establish the request
                    HttpWebRequest loHttp =
                         (HttpWebRequest)WebRequest.Create(url);
    
                    // *** Set properties
                    loHttp.Timeout = 10000;     // 10 secs
                    loHttp.UserAgent = "Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0) (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
                    loHttp.Headers["Accept-Encoding"] = "gzip";
                    // *** Retrieve request info headers
                    HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
    
                    Encoding enc = Encoding.GetEncoding(1252);  // Windows default Code Page
    
                    StreamReader loResponseStream =
                       new StreamReader(loWebResponse.GetResponseStream(), enc);
    
                    string lcHtml = loResponseStream.ReadToEnd();
    
                    loWebResponse.Close();
                    loResponseStream.Close();
    
                    if (lcHtml.Length > 0)
                    {
                        Console.WriteLine("Vote " + i.ToString() + ": SUCCESS");
                        i++;
                    }
                    else
                        Console.WriteLine("Vote " + i.ToString() + ": FAILED");
                }
    

    Marked as community wiki, so that if anyone know why, please edit… 🙁

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm using this example implementation found at http://tangentsoft.net/wskfaq/examples/basics/select-server.html This is doing most of what
In our data access layer at work we have this standard implementation where the
In other words, is this Singleton implementation thread safe: public class Singleton { private
This is just to satisfy my own curiosity. Is there an implementation of this:
This is a part algorithm-logic question (how to do it), part implementation question (how
I require a tree / directed acyclic graph implementation something like this: public class
Is there an openID implementation in Java? I would like to use this in
Is there a good equivalent implementation of strptime() available for Windows? Unfortunately, this POSIX
I am using this implementation of ReadDirectoryChangesW to monitor changes to the desktop. My
I made this implementation for this problem : http://www.spoj.pl/problems/SHOP/ #include<iostream> #include<stdio.h> #include<queue> #include<conio.h> #include<string.h>

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.