I have an application in which we have files that are being served from a secure encrypted file system to the user. THe files are decrypted on the fly by the application and then pushed to the client through the response header. This works perfectly fine in all browsers and iOS devices, but fails on all androids. It just simply says the download failed.
I have tried many different solutions that have been suggested around for android devices, as they seem to have a lot of problems with files like this. Nothing has seemed to work.
- change file extension to be in all caps in the Content-Disposition header
- tried multiple content types (application/octet-stream and specific file types)
Below is the actual code writing the response headers.
strMimeType = objDocument.FileMime
If strMimeType = "" Then
strMimeType = "application/octet-stream"
End If
HttpContext.Current.Response.ContentType = strMimeType
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" & objDocument.Filename)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.WriteFile(Server.MapPath("/FS/CO/" & objDocument.DocumentID & "/" & objDocument.Filename))
HttpContext.Current.Response.Flush()
HttpContext.Current.Response.Close()
HttpContext.Current.Response.End()
this worked for me - adb logcat DownloadManager:I *:S
that shows in the adb logcat only things from the downloadmanager. i am on a samsung galaxy s4 so if you have something different and you probably do you have to find out the name of your download manager by google, or start the log : use "adb logcat" do that, and then download the file then quickly scroll up to stop the adb from printing more stuff, and then find it.
i got this problem: I/DownloadManager( 9250): Initiating request for download id = 2011 with mAllowedNetworkTypes = -1 forP2Pbit = 8194 W/DownloadManager( 9250): Aborting request for download 2011: http error 403, mContinuingDownload: false FinalStatus = 403
i think it has something to do with my server but my server works just fine. so im not sure why it is breaking