Monday, May 28, 2012

Copy an image from internet:

private void CopyFile(string file)
        {
            WebRequest req = WebRequest.Create(@"http:....." + file);
            req.Proxy = new WebProxy("1.1.1.1", 8080);
            req.Proxy.Credentials = new NetworkCredential(@"user", "pass");
            WebResponse responsePic = req.GetResponse();
            Image webImage = Image.FromStream(responsePic.GetResponseStream()); // Error
            webImage.Save(@"D:\\pictures\" + file);
        }

No comments:

Post a Comment