Solved

How to display pdf documents that do not have .pdf extension in internet explorer

Posted on 2008-06-20
13
423 Views
Last Modified: 2013-12-08
I have created a document viewer in ColdFusion to retrieve documents out of our imaging database.  Hyperlinks to the documents are dynamically created and reference an asp.net webservice.  The url to the retrieve the documents looks like the following: http://servername/pathtowebservice/getImg.aspx?documentID=51086fd9-8518-4cc2-a9fd-528b8f9fe4f8, where documentID is a unique identifier to the document without a file extension.  Most documents are .tiff, which we have set to open with Microsoft Office Document Imaging with no issues.  However, internet explorere displays "Internet explorer cannot display this webpage" when trying to access documents of type PDF.  I tried disabling the "display in browser" feature of Adober Reader, and the links will open up in Reader. I am able to right-click the link and "save as", and the file is retrieved and downloaded and as a PDF.  Due to other programs in use, I need the ability to open PDF's in internet explorer and this was not a viable solution.  I have tried configuring PDF MIME types in IIS on both the calling and receiving servers with no success.  I have repaired the Adobe installation and cheked for the existence of the necessary .dll files and add-ons in internet explorer. LInks to other PDF documents on different websites open in Internet Explorer without issue.   Any questions or comments on how I can get the PDF's to display will be greatly appreciated.  
0
Comment
Question by:lbhc
13 Comments
 
LVL 5

Expert Comment

by:virtuatech
Comment Utility
Does opening a PDF in IE work at any random site?  Try this:
http://vmware.com/files/pdf/ThinAppFAQ.pdf
0
 
LVL 11

Expert Comment

by:asafadis
Comment Utility
Look into setting the MIME type in the actual page, not the IIS server.
I'm no ASP expert, so I really can't provide any examples... but the concept remains.
0
 
LVL 1

Author Comment

by:lbhc
Comment Utility
virtuatech,
as mentioned in my question I have no problem accessing PDF's from other websites or other applications I have written.  The problem seems to solely rest on retrieving the PDF's from the webservice, or more precisely a link to a pdf that does not contain the .pdf extension.
0
 
LVL 1

Author Comment

by:lbhc
Comment Utility
asafadis:
thank you for your reply, but the document does indeed have it's MIME type set before it is saved in the database.  WIthout that eventuality, I do not believe that I could right-click the link and have it saved automatically as a PDF, which is the behavior that is currently produced.  
0
 
LVL 5

Expert Comment

by:virtuatech
Comment Utility
It has to be something in the programming of your webservice.  There is no problem with IE if you are able to do it on other sites.  Do the TIF files behave the same way, I mean like when you do a save as, they do not have the .TIF extension?
0
 
LVL 1

Author Comment

by:lbhc
Comment Utility
virtuatech:
Each call to the webservice is made with the documentID, which does not include an extension.  This goes for .TIF files as well as HTML and JPG files.  In every case, the file will open with the appropriate application. TIF with Document Imaging, HTML and JPG within Internet Explorer.  It is only the PDF files that will not open.  If I right click the PDF link and do a Save As, I get a dialog box that says "getting file information" from getImg.aspx (the webservice function), a few seconds later a save dialog box will open with getImg.pdf (including the extension) filled in for the file name and saves appropriately as a pdf.  The pdf seems to be recognized as such with this explicit download instruction, just not by clicking the link directly.  
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 5

Expert Comment

by:virtuatech
Comment Utility
What is the URL shown in the address bar when the PDF link is left-clicked, after the "Internet Explorer cannot display this webpage"?
0
 
LVL 1

Author Comment

by:lbhc
Comment Utility
0
 
LVL 5

Expert Comment

by:virtuatech
Comment Utility
Have you tried it with Firefox? or IE7?  Or maybe updating Acrobat viewer...
0
 
LVL 1

Author Comment

by:lbhc
Comment Utility
virtuatech:
I am currently using IE7 and have the latest version, and no other version of Reader installed.  Using Firefox yields interesting results.  Clicking on the link in Firefox yields a Open With / Save to disk dialog where I can choose to open the link with Acrobat Reader (executable AcroRd32.exe), which opens the file properly.  It is due to this behavior, and the fact that I can disable PDF's from opening in internet explorer through the preferences in Adobe Reader and the link opens just fine in Reader, that I believe the problem rests in the the Acrobat plugins for IE, or how IE is configured to access pdf's and / or files without extensions.  Using firefox however is not an option for my company and therefor is unfortunately not a solution to this particular problem.  
0
 
LVL 5

Expert Comment

by:virtuatech
Comment Utility
Is your Reader version up-to-date?  Try reinstalling it.
0
 
LVL 5

Expert Comment

by:virtuatech
Comment Utility
Check the settings in Internet Options -> Programs -> Manage Addons...
0
 
LVL 7

Accepted Solution

by:
Dauhee earned 500 total points
Comment Utility
with asp.net could you write it out to the browser with something like:

                Response.Clear()
                Response.ContentType = "Application/pdf"
                Response.AddHeader("Content-Disposition", "inline; filename=" & IO.Path.GetFileName(strFileName).Replace(" ", "_"))
                Response.WriteFile(strFileName)
                Response.Flush()
                Response.End()


this way the browser is told what application to use and won't be concerned with the file extention
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now