G+_Joe Maruschek Posted September 16, 2014 Share Posted September 16, 2014 Here's another class that I think you might find useful. Padre's downloader class is ok, but I wanted something that would let me download a web site right into a string. The WebClient class in the .NET FCL is pretty easy to use, and it has a bunch of methods for downloading and uploading stuff to the web. I made a small example program that downloads the current Astronomy Picture of the Day web page into a string. Then I used the Regex class to find the image tag in it, and then I download the image file. If you run the code on your computer, be sure to change the location where the file gets saved, or the WebClient class will throw an exception that it couldn't download the file. You can read more about all the methods and properties of the WebClient class here: http://msdn.microsoft.com/en-us/library/system.net.webclient%28v=vs.110%29.aspx https://github.com/joemarus/csharp_part2_examples/blob/master/WebClientExample.cs Link to comment Share on other sites More sharing options...
G+_Nate Follmer Posted September 16, 2014 Share Posted September 16, 2014 Nice Joe Maruschek! My second... (third, maybe? Too many hobbies) love is astronomy, always good to find programs that involve ones interests. Link to comment Share on other sites More sharing options...
G+_Louis Maresca Posted September 17, 2014 Share Posted September 17, 2014 Nice and Simple Joe! Great Example! Link to comment Share on other sites More sharing options...
G+_Shannon Morse Posted September 18, 2014 Share Posted September 18, 2014 Thanks for sharing Joe! It totally makes sense and is very easy to understand. I'll share this on the show if you don't mind. :) Link to comment Share on other sites More sharing options...
Recommended Posts