I’d like to create a asp.net download page. I receive the file from a dataservice as a byte array. The file size can be up to 10gb. So I need to transfer the file “in parts”.
Here is my code:
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", _
"attachment; filename=" & HttpUtility.UrlEncode(file.Name))
Do
If Not Response.IsClientConnected Then
Exit Do
End If
result =ReadByte(offset,length) 'read next byte array
Response.BinaryWrite(fresult.Data)
Response.Flush()
Loop Until 'all bytes read
The code snippet works but I have a big problem. The download already starts before the user confirmed the browser download dialog. If the user waits 5min he has already downloaded the 10gb file without accepting it.
Do you have any solutions?
Thank you
This code need just to updated it to read from file instaed of web response