To verify that the client fully download a file from your server, you must implement a page that reads the stream passing through the file and send it to the client. When sending simply verify that the property remains Response.IsClientConnected to True as long as necessary.

Response.Clear ()
Dim b(1024 * 128) As Byte
Dim DownLoadAbort As Boolean = False
Dim f As IO.FileStream = New IO.FileStream("c:\filename.txt", IO.FileMode.Open)
Response.AddHeader("Content-Disposition", "attachment;filename=filename.txt")Response.AddHeader("Content-Length", f.Length.ToString)
Do While f.Position
f.Read(b, 0, 1024 * 128)
Response.OutputStream.Write(b, 0, 1024 * 128)
If Not Response.IsClientConnected Then
DownLoadAbort = True
Exit Do
End If < f.Length
Response.Flush()
Loop
f.close () If Not
DownLoadAbort Then
'DOWNLOAD COMPLETED SUCCESFULLY
Else
End If Response.End ()
0 comments:
Post a Comment