Problem in displaying PDFs on Google Chrome

Discussion in '.NET' started by HinaAsp.Net, May 12, 2011.

  1. HinaAsp.Net

    HinaAsp.Net

    Joined:
    May 12, 2011
    Messages:
    2
    Likes Received:
    0
    Hello Everyone,

    I have some PDF files saved in binary form in database. When I try to display these files on browser it just asks me to save the file as ".aspx" page. These PDFs are displayed fine in FireFox/IE and this ".aspx" Save as issue comes in Google Chrome only. For testing of my code I try to display the binary image files and images are displayed fine in Chrome but as soon as I start displaying the PDFs the Chrome just asks user to save .aspx page.

    Also I dont want to download the PDF as attachment on user's system, I want to display it in browser itself. Please have a look at my code and suggest what wrong I am doing. This code is working as desired in FF and IE. The code is:

    Response.ClearHeaders();
    Response.ClearContent();
    DataSet dspdf = new DataSet();
    dspdf = SiteProvider.ClientConfiguration_Site.getpdffilebyname("Medicare");
    byte[] bytedata;
    bytedata = (byte[])dspdf.Tables[0].Rows[0]["pdfdata"];
    Response.ContentType = "application/pdf";
    Response.AddHeader("content-length", bytedata.Length.ToString());
    Response.BinaryWrite(bytedata);
    Response.End();
     
    HinaAsp.Net, May 12, 2011
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.