Navigation


RSS : Articles / Comments


Download File using Dot Net

2:34 AM, Posted by ruchira, No Comment

In this post, I will demonstrate how easy it is to download a file from a web server to your local hard drive. In most scenarios, you may browse the net using your web browser and click on a hyperlink to start a downloading of a file from a remote site.
Some of you may be interested in how to download this using their application code using Dot Net.
This can be very easily achieved using the WebClient class under System.Net namespace.

First, import the System.Net namespace.

using System.IO;

The above LOC will do so.

Now, create an instance of WebCleient class.

WebClient client = new WebClient();

Now, call the DownloadFile method

client.DownloadFile(<url>, @"<fileDestinationName>.<filetype>");


Have fun. Cheers !!!!

No Comment



 
[source language="xml"] [/source]