iFrame launching new window for PDF

513 views Asked by At

Okay so I am having some trouble finding an answer for this through google.

I am trying to setup a site using c# that will display an embedded PDF on the page using dynamic file names. Here is my code:

aspx: < iframe style="vertical-align:auto" name="pdfIframe" id="pdfIframe" width="1024px" height="1200px" runat =server></iframe >

cs: pdfIframe.Attributes["src"] = @"" + fullfilepath;

"fullfilepath" is a string that contains the file path for the pdf I want to open. The problem I'm running into is that the PDF is opening fine when I run the debugger but once I publish the site and navigate to it from another PC it opens the pdf in Adobe Reader and not the iframe regardless of what browser I am using. Am I missing something here?

1

There are 1 answers

0
Matt P On BEST ANSWER

So my problem was that the file path I was using @"\servername\e$\folder\folder" needed to be shared out and changed to "\servername\folder\folder". It's funny how two characters can screw up your whole project and steal two hours of your day!