PDF "Download Failed" Only on Android Phones

I know that similar questions were asked, but none of them answered. As the title implies, the PDF document is successfully extracted to the PC as well as the iPhone from the URL (the URL calls the C # web API controller, and the function returns the PDF file to HttpWebResponse), but as soon as it concerns Android phones, he says “Download Unsuccessful,” unless the link is open in Opera.

The code below shows how a web response from a third-party web service is converted to pdf and displayed:

bytes = Convert.FromBase64String(node.Value); res.Content = new ByteArrayContent(bytes); res.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf"); res.Content.Headers.Add("Content-Disposition", "inline; filename=NatisDocument.PDF"); 

I tried changing the mime type to application / octet-steam, it still does the same thing, and I got stuck in the same problem for 2 business days.

Can anyone help? Or experienced the same disorder?

+6
source share
2 answers

On an Android 4.4.2 device, I have no problem opening PDF online in Mozilla Firefox. However, the “Download unsuccessful” error occurs in Google Chrome and in the native Android browser only when extracting PDF from a secure URL ( https: // ... ). In this case, do not use the link, but click the link and select “Save link” in the context menu; then click "Open." See also https://android.stackexchange.com/questions/62894/android-download-pdf-giving-download-unsuccessful

+1
source

From android lolipop sdcard is not writable by default. Try changing the default boot memory to internal, and downloading files will not be unsuccessful.

-1
source

All Articles