Solved

ASP.NET download remote image from remote server via http

Posted on 2011-02-26
1
612 Views
Last Modified: 2012-05-11
I'm trying to download an image from a remote website via http.  What I've got so far is

WebRequest wr = WebRequest.Create(src);
Image img = Image.FromStream(wr.GetResponse().GetResponseStream());
img.Save("mydownload.gif");

I got this code from an example I found on online.  But the Image class doesn't seem to have a From Stream method.

How do I convert the response stream into an image that I can save to my web server?

Thanks
0
Comment
Question by:JosephEricDavis
1 Comment
 
LVL 12

Accepted Solution

by:
geowrian earned 500 total points
ID: 34988943
I think this approach may be simpler:

WebClient Client = new WebClient ();
Client.DownloadFile(src, "mydownload.gif");

http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=115
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
WPF - Tooltips for ComboBox items 5 37
Syntax error 9 45
Displaying a web form as a modal popup dialog box. 4 23
Adware on IIS hosted asp.net website 1 17
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now