Hallo,
I want todownloadapicture from SharePoint, Itested thecode inconsole and that's good butatwebpartI habe alwayserrorat
image =System.Drawing.Image.FromStream(webstream)Parameteris not valid
HttpWebRequest httpWebRequest = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(imageUrl);
httpWebRequest.UseDefaultCredentials = true;
httpWebRequest.PreAuthenticate = true;
httpWebRequest.Credentials = CredentialCache.DefaultCredentials;
httpWebRequest.AllowWriteStreamBuffering = true;
httpWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)";
httpWebRequest.Referer = "http://www.google.com/";
System.Net.WebResponse webResponse = httpWebRequest.GetResponse();
System.IO.Stream webStream = webResponse.GetResponseStream();
image = System.Drawing.Image.FromStream(webStream);
webResponse.Close();
webResponse.Close();