1

I am using this code for creating pdf viewer in my application https://amitpatriwala.wordpress.com/2009/08/28/pdf-viewer-in-asp-net/

it works fine when I give it a path for a file inside my application folders, ex: displaypdf1.FilePath= @"~/MyFolder/" + Hello.pdf;

but now I want to give this displaypdf1.FilePath an absolute path to read the pdf file which is not in my application folders, I tried but it didn't work!

user1947393
  • 153
  • 4
  • 18
  • If the IUSR or ASPNET account is given access to the path, it can read the file. – gn1 Jun 02 '15 at 04:14

1 Answers1

2

A web page cannot access items that are outside of the website. If you want the web page to reference files located in D:\PDFs, for example, you need to create a virtual directory in your website that points to "D:\PDFs". Then the web pages can access them by ~/PDFs/Hello.pdf.

You'll also need to ensure that the website has appropriate permissions to access the directory.

Tony Hinkle
  • 4,706
  • 7
  • 23
  • 35