1

what i'm trying to do this this. Simply create a C# windows app that when that when i point it to a website will download the HTML code. Kind of like when you use IE and you choose view source. Any starting point would be great.

1
  • If you use WebClient or HttpWebRequest as per the answers provided here - then be sure to make sure that the proxy settings are correct. One way of doing this is to use the app.config System.Net configuration section. Commented Mar 30, 2010 at 20:33

5 Answers 5

5

Have a look at the WebClient class.

Sign up to request clarification or add additional context in comments.

Comments

3

You probably want to look into HttpWebRequest in .NET.

WebClient may be another class for you to explore.

It provides an HTTP specific implementation of WebRequest which can be used to download HTML (or any other content, really) using the HTTP protocol.

Comments

2

Have you looked into the WebClient class?

using(WebClient webClient = new WebClient())
{
    string html = webClient.DownloadString("http://www.someurl.com");
}

Comments

0

You could create a wrapper around wget, which already does all the heavy lifting.

1 Comment

While this is a possible solution, .NET provides very clean methods to perform the task the OP wants to do via WebClient.
0

You should look for HttpWebRequest class. You can use it for making requests. Also take a look on a ready-made solution Watin

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.