我正在尝试通过获取图像HttpWebRequest
并以获胜形式显示它imagebox
。通过 Fiddler ImageView 选项卡跟踪请求时,我可以看到可以正确看到图像,但是在读取流时出现Stream was not readable
错误
Image img = Image.FromStream(stream).
我错过了什么?
HttpWebRequest req = HttpWebRequest request = (HttpWebRequest)WebRequest.Create("[URL here]");
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Stream stream = response.GetResponseStream();
Image img = Image.FromStream(stream); // ERROR occurs here
stream.Close();