edge does not download pdf documents, while chrome does

Luai Assori 0 Reputation points
2025-11-13T21:42:15.06+00:00

we have an application that sends pdf binary from .NET application on the backend to the browser, using BinaryWrite method on HttpContext, and Content-Disposition Header
when using chrome, the file downloads when testing with express IIS on VisualStudio, as well as when the application is published and hosted on a IIS server,
however, in the case for edge, the file downloads when testing with IIS Express and Visual Studio,
but when application is published and hosted on an IIS server, the file does not download,
I have gone into lengths allowing Insecure Site, allowing popups .. etc , and also looked into MIME types, everything is setup correctly, Chrome does not have any issues downloading the file, Edge goes completely dead. I have come to the conclusion that it must be a bug with some recent updates to Edge,

could you please help get this resolved ?
Thank you

Microsoft Edge | Read PDFs | Windows 11
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Randy Baroja 18,665 Reputation points Independent Advisor
    2025-11-14T00:46:13.5466667+00:00

    Hi,

    You can try this: ensure your .NET application sets the Content-Type to "application/pdf" and the Content-Disposition header to "attachment; filename=\"yourfile.pdf\"" before writing the binary data with BinaryWrite, then call Response.Flush() and Response.End(); additionally, in IIS, make sure the server isn’t compressing PDF responses (disable dynamic compression for PDFs) and that HTTPS is properly configured, because recent Edge updates sometimes block downloads over HTTP or with certain headers, these steps often resolve the issue where Edge fails to download PDFs while Chrome works fine.

    Do you want me to give a small code example showing the recommended way to stream the PDF to Edge safely?

    Kind regards,


  2. Randy Baroja 18,665 Reputation points Independent Advisor
    2025-11-15T13:00:06.26+00:00

    Hi,

    Of course, and I completely get why you want to compare code side-by-side. Here’s a clean, reliable pattern for streaming a PDF that Edge is generally happiest with. I’ll also add brief explanations so you can easily spot where things might differ from your implementation:

    public void StreamPdfToBrowser(byte[] pdfBytes, string fileName)
    {
        var response = HttpContext.Current.Response;
        // Clear anything that may have been written earlier
        response.Clear();
        response.Buffer = true;
        // Required headers
        response.ContentType = "application/pdf";
        response.AddHeader("Content-Disposition", $"attachment; filename=\"{fileName}\"");
        response.AddHeader("Content-Length", pdfBytes.Length.ToString());
        // Turn off IIS compression for this response
        response.Filter = null;
        // Write the file data
        response.BinaryWrite(pdfBytes);
        response.Flush();
        // For Edge compatibility, prevent further processing
        response.SuppressContent = true;
        HttpContext.Current.ApplicationInstance.CompleteRequest();
    }
    

    Why each part matters:

    Clear/Buffer helps prevent extra output (Edge is more sensitive to stray bytes).

    Content-Length is important , Edge sometimes hangs if this is missing.

    Filter = null bypasses IIS compression issues that can break PDF responses.

    CompleteRequest() avoids ThreadAbortException and ensures Edge gets a clean response.

    Kind regards,


  3. Randy Baroja 18,665 Reputation points Independent Advisor
    2025-11-16T22:15:26.38+00:00

    Hi,

    I’m really sorry the issue is still happening, and I understand how frustrating it is since everything works fine in IIS Express but stops once it’s deployed to full IIS. That really does point to something specific in the Edge + IIS combination. I appreciate your patience, and if I find any other workaround or fix, I’ll follow up and help you further.

    Kind regards,

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.