stream does not support seek operations 

 

When  I use HttpWebResponse.GetResponseStream();  the stream does't support seek

 

so  try to transfers to MemoryStream

1 using (Stream Result = request.HttpWebResponse.GetResponseStream())
2 {
3     MemoryStream streamResult = new MemoryStream();
4     byte[] buf = new byte[1024 * 8];
5     int count = await Result.ReadAsync(buf, 0, 1024 * 8);
6     streamResult.Write(buf, 0, count);
7 }

 

this can work well, but  firstly I did't use await method the stream also lost bytes ,I user Result.Read() Method;

I worry so much,But the next day, I checked the website MSDN ,  I see Async  the keywords, oh  I feel this will be help ,  It solve the problem . 

 

hope this help to your

 

posted on 2013-10-12 10:05  纵横九洲  阅读(502)  评论(0编辑  收藏  举报