Error “This stream does not support seek operations” in C#
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to get an image from an url using a byte stream. But i get this error message: This stream does not support seek operations. This is my code: byte[] b; HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(url); WebResponse myResp = myReq.GetResponse(); Stream stream = myResp.GetResponseStream(); int i; using (BinaryReader br = new BinaryReader(stream)) { i = (int)(stream.Length); b = br.ReadBytes(i); // (500000); } myResp.Close(); return b; What am i doing wrong guys? 回答1: You probably want something like this. Either checking