我试图读完一个方法,但在br.ReadBytes行中得到了一个错误"Specified responseStream is not supported“。
我做错了什么?
WebResponse imageResponse = imageRequest.GetResponse();
Stream responseStream = imageResponse.GetResponseStream();
using (BinaryReader br = new BinaryReader(responseStream))
{
imageBytes = br.ReadBytes((int)responseStream.Length);
br.Close();
}发布于 2019-01-16 17:09:43
我收到错误: NotSupportedException:此流不支持查找操作。
假设您想要一个字节数组,为什么不让获取图像变得更容易:
byte[] imageBytes
using (var webClient = new WebClient()) {
imageBytes = webClient.DownloadData("http://yourimage");
}https://stackoverflow.com/questions/54213326
复制相似问题