I just started experimenting with C# WebClient
. What I have is the code below which gets html code from a website and writes it in a .txt file. The only problem I have is that some websites require you to accept cookies before you can use the website. What this causes is instead of writing the real website html code to the .txt file, it writes the cookie popup html code.
Code:
string downloadedString;
System.Net.WebClient client;
client = new System.Net.WebClient();
//"http://nl.wikipedia.org/wiki/Lijst_van_spelers_van_het_Nederlands_voetbalelftal"
downloadedString = client.DownloadString(textBox1.Text);
using (StreamWriter write = new StreamWriter("Data.txt"))
{
write.Write(downloadedString);
}
So what is the solution to this? Can somebody direct me to the right path?
See Question&Answers more detail:os