tags:

views:

738

answers:

2

We've got an IFrame on a page (let's call that page DocViewer.aspx) the src of which is set to another page. Let's call that other page DocContent.aspx

ere's the page load on DocContent.aspx.vb:

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    'get pdf bytes from session
    Dim pdfBytes As Byte() = CType(Session("PDFBytes"), Byte())

    'remove pdf bytes from session
    Session.Remove("PDFBytes")

    With Response
        ' Set the response type to PDF
        .ClearHeaders()
        .Buffer = True
        .ContentType = "application/pdf"
        .AddHeader("Content-Disposition", "inline; filename=" & "midoc.pdf")


        .AddHeader("Content-Length", (pdfBytes.GetUpperBound(0) + 1).ToString)
        Response.OutputStream.Write(pdfBytes, 0, pdfBytes.Length)

        .End()
    End With ' response

End Sub

and here's the DocContent.aspx page in all it's glory:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="DocContent" Inherits="OurCompany.OurNamespace.DocContent" %>

The reason we're using an IFrame is to alow us to host the PDF in a page that also runs some scripts and has some more controls on (if a certain condition is met, we pop up a modal dialog using the modal dialog extender ,but we've switched that behaviour off and the problem is still occuring). Not using an IFrame isn't a doable solution either. I've checked the security settings in IE and they're all set to allow IFrames to be dislayed.

Here's the problem then - on some testers PCs the page displays the pdf fine. On others we just get a blank page.

Just seen a machine that wasn't displaying start displaying when it was upgraded to IE7. This unfortunately is not a solution as we have to support anything down to IE5.5 :(

I'd be super grateful for any ideas anybody has.

I should also mention that these machines have no trouble when navigating to a page similar to DocContent directly (rather than being hosted in an IFrame).

Oh and thanks in advance for your help.

A: 

We had a similar issue to this at work where some users would end up on a blank screen. The fix we did was to save the file to disk and then redirect the browser to that file. We also put some code in place so that when a user requests a file it does a clean-up of the folder (deleting everything over say an hour old).

Paul Porthouse
A: 

It's possible that the clients which are misbehaving have problems with their installation of Adobe Acrobat Reader. It has settings for whether it should appear inside of a browser window or externally.

The solution may be as simple as uninstalling Acrobat Reader, Rebooting, Reinstalling Acrobat Reader with the default settings.

Robert Bratton