WEBSITE

Download Web Content via HTTP

9/26/2010 7:43:11 PM
The System.Net.WebClient class provides most of the functionality you will ever need, as demonstrated in the following example:
string url = "http://www.microsoft.com";
string outputfile = "temp.html";

using (WebClient client = new WebClient())
{
//could also do: byte[] bytes = client.DownloadData(url);
try
{
client.DownloadFile(url, outputfile);
}
catch (WebException ex)
{
Console.WriteLine(ex.Message);
}
}

This is very easy to do, but DownloadFile is a synchronous method, which means it will wait until the file is done before returning. This isn’t great if you want to allow the user to do other things in the meanwhile (or to be able to cancel the transfer).

Other  
 
Most View
ASP.NET 3.5 : Writing HTTP Modules (part 1) - The IHttpModule Interface, A Custom HTTP Module
Something You Should Know About Iphone 5 (Part 2)
Html 5 : Text Tags and a Little CSS3 - The Fundamentals
PowerShell for SharePoint 2013 : Word Automation Services - Disable Word 97–2003 Document Scanning , Disable Embedded Fonts in Conversions
Windows 7 : Interacting with the Built-In Security Features - ACCESSING APPLOCKER (part 2) - Reading AppLocker Entries
Keep Selective Colour In Mono Conversions (Part 2)
Panasonic Lumix GF6 Latest Mirrorless Camera Review (Part 1)
Get More Space On Your Phone, Tablet & PC (Part 2) - Clear out clutter
Head Audio Canalot DAC Headphone Amp/Preamp - Space Oddity (Part 1)
How To Keep Your iPod More Durable
Top 10
Sharepoint 2013 : Farm Management - Disable a Timer Job,Start a Timer Job, Set the Schedule for a Timer Job
Sharepoint 2013 : Farm Management - Display Available Timer Jobs on the Farm, Get a Specific Timer Job, Enable a Timer Job
Sharepoint 2013 : Farm Management - Review Workflow Configuration Settings,Modify Workflow Configuration Settings
Sharepoint 2013 : Farm Management - Review SharePoint Designer Settings, Configure SharePoint Designer Settings
Sharepoint 2013 : Farm Management - Remove a Managed Path, Merge Log Files, End the Current Log File
SQL Server 2012 : Policy Based Management - Evaluating Policies
SQL Server 2012 : Defining Policies (part 3) - Creating Policies
SQL Server 2012 : Defining Policies (part 2) - Conditions
SQL Server 2012 : Defining Policies (part 1) - Management Facets
Microsoft Exchange Server 2010 : Configuring Anti-Spam and Message Filtering Options (part 4) - Preventing Internal Servers from Being Filtered