[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 659
  • Last Modified:

ASP.NET download remote image from remote server via http

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
JosephEricDavis
Asked:
JosephEricDavis
1 Solution
 
geowrianCommented:
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now