I have big file (about 2GB) to distribute to our customer, My website is written by asp.net vb, this is my file download handler:
Public Class FileHandler
Implements IHttpHandler
Public Sub ProcessRequest(ByVal httpcontext As HttpContext) Implements IHttpHandler.ProcessRequest
If HttpContext.User.Identity.IsAuthenticated Then
Dim FileName As String = HttpContext.Request.QueryString("File")
HttpContext.Response.Buffer = False
HttpContext.Response.Clear()
HttpContext.Response.AddHeader("content-disposition", "attachment; filename=" & FileName)
HttpContext.Response.ContentType = "application/exe"
HttpContext.Response.TransmitFile("~/download/ExE/" & FileName)
HttpContext.Response.Flush()
HttpContext.Response.Close()
End If
End Sub
Public ReadOnly Property IsReusable As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class
My problem is this handler sometimes could not work properly. Most customer could download it by this handler, but some customer click the download link, it will endless waiting for server's response, after long time waiting, it shows the error page says the IE cannot display the webpage. some customer try to download the file from IE8, it will show the error page directly. I am really appreciate any one can help with this issue. Thank you!
I use a button or just a plain link to the file itself, I've never had to use a handler to download files.
For example, on the aspx I have a button and in the code behind I send the user to the file using the response object: