locked
displaying a file from network path rather than application path RRS feed

  • Question

  • User351619809 posted

    I am trying to display a pdf file using this code:

     <object class="ss-pdfjs-viewer" id="pdfDocument" runat="server" data= "Documents/test1.pdf" type="application/pdf" allowfullscreen webkitallowfullscreen  >
                        <iframe class="ss-pdfjs-viewer" id="test"    src="https://docs.google.com/viewer?url=https://localhost:44307/WebForm1&embedded=true&allowDownload=true&allowPrint=true" allowfullscreen webkitallowfullscreen></iframe>
                  </object>
    

    The above code works fine. The issue is this pdf file called test1.pdf is stored in my application path. Is it possible to show a pdf file from a network path instead of the application path for e.g. if I have test1.pdf file stored at this location:

    \\web-d\test\path\test1.pdf. 
    

    what should I do if I need to display this pdf file from my network path rather than application path. I tried doing this and it didnt work, it didnt display anything on the web page:

     <object class="ss-pdfjs-viewer" id="pdfDocument" runat="server" data= "\\web-d\test\path\test1.pdf" type="application/pdf" allowfullscreen webkitallowfullscreen  >
                        <iframe class="ss-pdfjs-viewer" id="test"    src="https://docs.google.com/viewer?url=https://localhost:44307/WebForm1&embedded=true&allowDownload=true&allowPrint=true" allowfullscreen webkitallowfullscreen></iframe>
                  </object>
    

    any help will be greatly appreciated.

    Sunday, December 27, 2020 4:49 AM

Answers

  • User753101303 posted

    Hi,

    Check F12 Console for messages. AFAIK a web page can't use file:// for safety reason (it would work with a local html file) at least without a browser configuration change.

    Your web site can't access this file itself? The basic idea is to deliver all the content using http(s).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, December 27, 2020 9:20 AM