Pages

Thursday, 26 February 2015

How to Download Image using an URL (C#)


Hi All, Today I am going discuss how to get a Image from a remote location using an URL. This is very easily can be done using two .Net Classes called HttpWebRequest and HttpWebResponse

 

You need to have following References to make above code work;


Here a HTTP web request is generated using your URL and response is assigned to a System.IO.Stream object. Then your familiar System.Drawing.Image class has a method to convert that stream Object to an Image Object. That's all now you have the image in the remote location downloaded to your program.


No comments:

Post a Comment