ASP.NET - CannotOpen local pdf using iframe : frmCntrl.Attributes.Add("Src", "C:/ShortcutKeys.pdf");

Asked By Chetan Sirigur on 01-Apr-15 07:49 AM
Hi All,

Please note, I am trying to open pdf from the local drive using code below

<iframe  id = "frmCntrl" runat = "server"></iframe>

frmCntrl.Attributes.Add("Src", "C:/ShortcutKeys.pdf");

Upon executing I am not getting any error message, but nothing is loaded in the IFrame space.

Could any one please help me how to resolve this issue OR how to load local pdf into the IFrame space.

Many thanks for your help in advance.

Regards,
Chetan.

 
Robbe Morris replied to Chetan Sirigur on 01-Apr-15 08:14 AM
You cannot open local files from a web page delivered from a web server other than your desktop.
Chetan Sirigur replied to Robbe Morris on 02-Apr-15 12:26 AM
Robbe,

If it is possible to open local files from the browser menu bar, then I belive we can open the local/server files programatically.

To be specific I am trying to open file with <iframe>.

Is their any <IFrame> code to open the file located in the local or server ?

Many thanks for your help in advance.
Robbe Morris replied to Chetan Sirigur on 02-Apr-15 08:29 AM
No.  Security constraints in the browser will stop this.  You'd need to write an ActiveX control (or java plugin) and grant it special permissions to perform this task.