locked
Fastest way to read a very large pdf file as byte array and view in in ASP.NET Web Forms 4 application RRS feed

  • Question

  • User1517784313 posted

    I need to display a pdf file in an ASP.NET Web Forms 4 application through an ascx user control. I'm using the below code for reading the pdf file as byte array and then write the byte array to the Response directly.

    var pdfBytes = File.ReadAllBytes(filePath);
    context.Response.BinaryWrite(pdfBytes);

    I tried using

    context.Response.TransmitFile(filePath);


    But its performance is not satisfying. In case of very large pdf files it's not performing well even though the pdf files were generated with Fast Web View option enabled. Can someone suggest a better solution for this?

    Thursday, November 19, 2020 8:46 AM

All replies