I'm having problems downloading an image from in internet location.
I've tried 2 methods:
andCode:request = (HttpWebRequest)WebRequest.Create(newUrl); request.Method = "GET"; response = (HttpWebResponse)request.GetResponse(); Stream imageStream = response.GetResponseStream(); Bitmap bmp = new Bitmap(imageStream); bmp.Save(GetFileName(url));
The first method throws an exception in the Bitmap constructor "Invalid parameter used." The second method saves the picture, put it is in the wrong format or something, because it can't be viewed, and is only 917 bytes on disk (actual image is 84000 bytes.)Code:WebClient client = new WebClient(); client.DownloadFile(newUrl, fileName);
Any ideas or other methods that can be used to download images?