62,046
社区成员
发帖
与我相关
我的任务
分享
iStream = new MemoryStream(d.Content);
long dataToRead = iStream.Length;
// Read the bytes.
while (dataToRead > 0)
{
// Verify that the client is connected.
if (Response.IsClientConnected)
{
// Read the data in buffer.
int length = iStream.Read(buffer, 0, 100);
// Write the data to the current output stream.
Response.OutputStream.Write(buffer, 0, length);
// Flush the data to the HTML output.
Response.Flush();
buffer = new Byte[100];
dataToRead = dataToRead - length;
}
else
{
//prevent infinite loop if user disconnects
dataToRead = -1;
}
}