Solved

ASP.NET download remote image from remote server via http

Posted on 2011-02-26
1
619 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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!
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

713 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