Hi.
Ich möchte ein Bild aus dem Internet auf meinen Computer laden. Habe mir dazu folgende Methode geschrieben:
C#-Quelltext
1: 2: 3: 4: 5: 6:
| HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.CookieContainer = cookiecontainer; request.UserAgent = useragent; HttpWebResponse httpWebReponse = (HttpWebResponse)request.GetResponse(); Stream stream = httpWebReponse.GetResponseStream(); Image image = Image.FromStream(stream); |
Und bei
Image image = Image.FromStream(stream); kommt es zu einer Exception: "Ungültiger Parameter".
Gebe ich die URL in meinen Firefox ein, dauert es etwa 15 Sekunden, dann ist das Bild da. Wie erreiche ich, dass auch mein Programm das Bild trotzdem bekommt?