H
hoenes1
How can I determine whether a download has been cancelled by the
client? I'm sending the file from an aspx page in chunks of 4K. When
the user presses "Cancel" in his download dialog, the next call of
Response.Flush() hangs and resets my Session Object after about a
minute. The Response.IsClientConnected property is still true after
the user pressed "Cancel". Is there a workaround for this problem?
The Code is:
// fs --> FileStream
// buffer --> byte[]
while (offset < filesize)
{
length = filesize;
if (length > blocksize)
length = blocksize;
fs.Read(buffer, 0, (int)length);
Response.BinaryWrite(buffer);
if (Response.IsClientConnected)
Response.Flush(); // here it hangs after the user cancelling
else
break;
offset += length;
}
Thanks in advance.
client? I'm sending the file from an aspx page in chunks of 4K. When
the user presses "Cancel" in his download dialog, the next call of
Response.Flush() hangs and resets my Session Object after about a
minute. The Response.IsClientConnected property is still true after
the user pressed "Cancel". Is there a workaround for this problem?
The Code is:
// fs --> FileStream
// buffer --> byte[]
while (offset < filesize)
{
length = filesize;
if (length > blocksize)
length = blocksize;
fs.Read(buffer, 0, (int)length);
Response.BinaryWrite(buffer);
if (Response.IsClientConnected)
Response.Flush(); // here it hangs after the user cancelling
else
break;
offset += length;
}
Thanks in advance.