Click here to Skip to main content
15,890,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I want to open PDF file in new window on button click event from code behind through JavaSctipt.

I am using below mentioned code for opening PDF file in new window.

XML
string PopUpWindowPage = @"E:\\\Prism4.pdf";
string Script = "";
Script += "<script id='PopupWindow'>";
Script += "confirmWin = window.open(' " + PopUpWindowPage + "','" + 1 + "','scrollbars=yes,resizable=1, width=960,height=500,left=50,top=130,status');";

Script += "</script>";
if (!Page.IsClientScriptBlockRegistered("PopupWindow"))
          age.RegisterClientScriptBlock("PopupWindow", Script);

I get below mentioned error message while opening the PDF file in new window.
Microsoft JScript runtime error: Access is denied.

Can Anyone tell me whats the issue with above code or any other settings have to do?

Thanks in Adv...
Posted

1 solution

I suspect that the asp.net account you are running under does not have permission to access the contents of the e:\ drive.

A simple way to test this is to move your PDF file, so that it sits in the sample folder as you asp.net project and see if it can be read from there.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900