I'm trying to download the source HTML of a website using the WebClient.DownloadData()
method.
My method is supposed to give me the source:
public string GetSite(string URL)
{
Uri Site = new Uri(URL);
byte[] lol = Client.DownloadData(Site);
SiteSource = Encoding.ASCII.GetString(lol);
return SiteSource;
}
I've TRIPLE checked and when I write the exact same url of the URL parameter I send this method, my programs downloads something else entirely.
Pressing ctrl+U in firefox to see the source code shows me what I need to see (again, simple HTML), but in my software I see something entirely different.
What gives?
FOR CLARITY:
Imagine in Firefox you write www.google.com, viewing the source in Firefox you see:
<html>
<head>
</head>
<body>
<h1>Hello!</h1>
</body>
</html>
But if I were to use the DownloadData
method for the exact same URL, my program would download a source code like this:
<html>
<head>
</head>
<body>
<h1>Bonjour!</h1>
</body>
</html>