Why does WebClient (System.Net) get url from url twice?
I have a method like this:
private string getFromURL(string url)
{
WebClient myClient = new WebClient();
return myClient.DownloadString(url);
}
using WebClient from System.Net. It seems to hit the URL twice (I also go through the log of the webserver in question and write it twice). Any idea why this might be?
EDIT: The answer was actually a programmer's mistake. I no longer have reason to think this is behaving strangely. Thanks for answers.
+2
shooter
source
to share
3 answers
check out tcpmon: https://tcpmon.dev.java.net/ is a Java tool, but you can easily run it without "java" involved.
There is most likely a redirect or something for yourself, so you should be able to see if the HTTP requests are the same or slightly different.
Also, check curl (cygwin) - you can test sending requests from there and see if there is a redirect or something.
+1
source to share