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);
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?