Solved

ASP.NET download remote image from remote server via http

Posted on 2011-02-26
1
599 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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

10 Experts available now in Live!

Get 1:1 Help Now