views:

141

answers:

4

I'm working on a project for fun but i want to grab just the html code from a website which I will later have to extract just the links.

I've been googling for a few minutes and I haven't found anything that does what I want specifically (just the text).

+4  A: 
WebClient client = new WebClient();
String htmlCode = client.DownloadString("http://born2code.net");
Crash893
+6  A: 

What you want is the HTML Agility Pack

David Hedlund
I heard that will only work if the page i use as my target validates as html. is that true?
Crash893
HTML Agility Pack is rather forgiving of malformed HTML - if it displays in a browser, the library can likely parse it.
Charlie Salts
+2  A: 

Have you looked at a standard tool like Httrack, or if you want to actually want the html if you're programming for fun look at WebClient or HttpWebRequest if you want to learn more.

RandomNoob
A: 

This was helpful to me a while ago -- Parsing HTML in C#

Jim