| | |
HttpWebRequest Help
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Apr 2008
Posts: 27
Reputation:
Solved Threads: 1
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?
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 : )
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?
C# Syntax (Toggle Plain Text)
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?
•
•
Join Date: Apr 2008
Posts: 27
Reputation:
Solved Threads: 1
•
•
•
•
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?
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
Last edited by DevC++4.9.9.2; Jun 10th, 2009 at 9:31 pm.
Here you go:
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
c# Syntax (Toggle Plain Text)
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
•
•
Join Date: Apr 2008
Posts: 27
Reputation:
Solved Threads: 1
•
•
•
•
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!
Last edited by DevC++4.9.9.2; Jun 10th, 2009 at 10:01 pm.
![]() |
Similar Threads
- HttpWebRequest on port 8000 (C#)
- ASP.NET wizard control (ASP.NET)
- Question : HttpWebRequest | form name (C#)
- unescaping uri in HttpWebRequest (VB.NET)
- Email an aspx page (or any webpage you want) (ASP.NET)
- HttwWebRequest.GetResponse not responding (C#)
- HttpWebRequest - No Response (ASP.NET)
- i want to post data with screen scrap page.. (ASP.NET)
- Send string to a web service (C#)
Other Threads in the C# Forum
- Previous Thread: WPF MediaElement displaying Images or Video with transitions
- Next Thread: Help with pattern matching
| Thread Tools | Search this Thread |
.net access ado.net algorithm array asp.net barchart bitmap box broadcast button buttons c# check checkbox client color combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ httpwebrequest image index input install java label libraries list listbox loop mandelbrot math mouseclick movingimage mysql operator path photoshop picturebox pixelinversion post programming radians regex remote remoting resourcefile richtextbox serialization server sleep socket sql statistics stream string system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf xml






