Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Open a PDF file in a new window
#1
Hi All,

I have changed the post completely as I now have a partly working solution:

I have managed to get a PDF file opened in a separat window, but only by copying the file into the wwwroot (contentpath) directory. When the file is there, WebApplication.NewWindows({filename}) will work. Both on IE11 and Edge.

However, the files I want to be able to open and show, are all on a document server (+/- 2 mill. files), and the program have access to the area. A function in the program checks the presence of the file before it allows the user to click a button to open and see the file. However, when WebApplication.NewWindow is called with a filepath, outside the wwwroot path, the browser that opens up, give an error 404.

So what does it take for the WA.NewWindow to be allowed to open a file on a shared network resource, outside the wwwroot path, but within the domain the webservice server is in ?

Obviously it works when the file is in the wwwroot directory, so a solution could be to copy the requested file over to wwwroot, show the file on screen, and then delete the copy after viewing it. The files are max. 5k each, so size is not a problem. But how do I copy it over ? FileExists(exactfilepath) works, but can I use something like XCopy(exactFilepath,contentpath) to copy it and then open it ? Or something similar ?

I've tried with Sendfile to get hold of the file on the document server, and to download it to the wwwroot dir, but sendfile do not work either. I hope someone else have been more sucessful and will explain how to.

Regards
Soren
Reply


Messages In This Thread
Open a PDF file in a new window - by SorenJensen - 10-10-2019, 09:18 PM
RE: Open a PDF file in a new window - by kudzu - 10-11-2019, 03:41 PM
RE: Open a PDF file in a new window - by kudzu - 10-11-2019, 05:03 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)