Click here to Skip to main content
15,921,959 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My code:
C#
string filePath = Server.MapPath("admit.pdf");
            myframe.Attributes.Add("src", "" + filePath.ToString());


Error :
Firefox doesn't know how to open this address, because the protocol(c) isn't associated with any program.


Please tell me how to solve this problem to show the pdf file in IFrame ?
Posted

1 solution

PDF is not a standard W3 file type; it is shown in the browser through the corresponding plug-in (an Adobe plug-in, in this case). The user needs to install the plug-in to have it working (http://www.adobe.com/downloads/[^]).

Your Web application should not rely on this. You should provide the access to the file, and the browser should suggest the user to download it or open with some application chosen by the user (as any other file type unknown to the browser). If the browser's settings have some default action for this content type, if can view it in browser, via a plug-in or otherwise.

As the first option, I would rather do the simplest possible thing:
HTML
<a href="admit.pdf">Admit.PDF</a>


In this case, any reasonable browser will behave exactly as I described above.

—SA
 
Share this answer
 
v4

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