Hello, I am trying to create a program to stress test a website, I am using a counter on the page to see how many "clicks" have been made to this website.

Currently i am using HttpWebRequest to make a connection to the site and then end it. However this is not registering on the page counter. Any ideas how to make this register?

private uint HitWebsite(string website)
        {
            HttpWebRequest request = (HttpWebRequest)
              WebRequest.Create(website);
            HttpWebResponse response = (HttpWebResponse)
                request.GetResponse();
            response.Close();
            return 1;
        }

This code is being called many times. Any ideas on how to make this work and/or what i might be doing wrong are welcome : )

The page counter is probably an embedded link or javascript. It depends on the page counter but you will likely need to do another get with the referring URL of your site. What hit counter are you using?

You need a Web Service (develop or buy) and JavaScript code to invoke Web service method.

Comments
to neutral yesterday
No, you don't. You need a web client like normal browser traffic.

The page counter is probably an embedded link or javascript. It depends on the page counter but you will likely need to do another get with the referring URL of your site. What hit counter are you using?

Thanks for your reply,

I am using two counters
The first is java, The second is HTML
On this test page:
http://www.funkohland.com/test/hitcounter

could you give me an example of "another get with the referring URL of your site"?

Thank you in advance

Here you go:

private void simpleButton1_Click(object sender, EventArgs e)
    {
      const string site = @"http://www.funkohland.com/test/hitcounter";
      GetPage(site);
      GetPage(@"http://simplehitcounter.com/hit.asp?uid=409840&f=255&b=0", site);
      GetPage(@"http://www.wundercounter.com/cgi-bin/stats/image.cgi?user=MasterDebater&page=www.funkohland.com/test/hitcounter&bgcolour=white&fontcolour=black&digits=5", site);
    }
    private static void GetPage(string URL)
    {
      GetPage(URL, string.Empty);
    }
    private static void GetPage(string URL, string Referrer)
    {
      HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(URL);
      req.Method = "GET";
      req.Referer = Referrer;

      HttpWebResponse objResponse = (HttpWebResponse)req.GetResponse();
      using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
      {
        sr.ReadToEnd();
        sr.Close();
      }
    }

Its your job to code in the asynchronous web requests to truly load test. If you use a single thread you will not accurately simulate a load. On another note I took the links from your pages' source good. If you're wanting to automate a task like this then you're looking in to link scraping and that is another topic (and very involved at that).

Good luck

Comments
Very helpful and fast response

Its your job to code in the asynchronous web requests to truly load test. If you use a single thread you will not accurately simulate a load. On another note I took the links from your pages' source good. If you're wanting to automate a task like this then you're looking in to link scraping and that is another topic (and very involved at that).

Good luck

Thank you very much, I am excited to start working off your example!

This question has already been answered. Start a new discussion instead.