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.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4GHP4Owod5FXMXzeoPfNJiTBt6IUxNPaJTN6-BKfPe4Q0D79yijSbMkpeo0bh3XEZUXx-esLeoby6d0R1iJHAeaIWUAl5xC1i3PvKihF6yuCLid_Q3S7o3k3c5p7c7K1uPQcl74zzG8FT/s400/Ein.jpg)
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