I have a problem explained here:
http://stackoverflow.com/questions/4674737/avoiding-content-type-issues-when-downloading-a-file-via-browser-on-android
I want to download an attachment when CMS.UIControls.UniGridConfig.Action is clicked. This control uses _doPostBack which makes POST requests but some native Android browsers only download attachments via GET method.
I made a workaround which sets a session variable in unigrid_OnAction, reloads the page and builds a response (as GET) with file in Page_Load.
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.AddHeader("Accept-Header", aDocument.Length.ToString());
Response.AddHeader("Content-disposition", "attachment; filename=\"Dokument.PDF\"");
Response.AddHeader("Content-Length", aDocument.Length.ToString());
Response.BinaryWrite(aDocument);
Response.End();
Works like a charm in all desktop browsers, on iPhone browser also on Android Google Chrome but on the
NATIVE ANDROID BROWSER IT DOESN'T. It writes the whole page's HTML source code (without the actual PDF data) into the PDF file and downloads it.
Spend 10 hours on google, nothing helped. Any ways to resolve this?