IIS 7.5 Not Serving PDF Files In Certain Web Browsers

Expand / Collapse
Summary:
This article is in reference to a problem where IIS 7.5 transfers byteranges to an Internet Explorer browser (and certain other browsers) improperly, causing the browserto crash or not display PDFs properly.

Applies To:
IIS7.5 and all versions of Adobe Reader prior to 10.x.x.

Steps:
This section can be implemented in the web.config, if you have the IIS rewrite module installed:

<rewrite>
<outboundRules>
<remove name="RewriteRanges" />
<rule name="RewriteRanges">
<match serverVariable="RESPONSE_Accept-Ranges" pattern=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_USER_AGENT}" pattern="^.*(MSIE).*" />
<add input="{URL}" pattern=".pdf$" ignoreCase="true" />
</conditions>
<action type="Rewrite" value="none" />
</rule>
</outboundRules>
</rewrite>

The line <add input="{HTTP_USER_AGENT}" pattern="^.*(MSIE).*" /> can be changed for any Mozilla based browser as well by substituting in MOZILLA in place of MSIE.

This will ensure the server does not transmit specific byte ranges and instead transfers the entire document.  Until Adobe releases the patch, this is a viable and tested option.  You can also implement this using the URL Rewrite module GUI built into IIS 7 (when the module is installed).  Here is a screen shot of how the settings should look:



Keep in mind, implementing this server wide can cause some performance degradation, but you may be forced to do so.  It is recommended to only implement this on the site that needs it.


Rate this Article:


Details
Category: IIS 7

Last Modified:Wednesday, November 20, 2013 3:34 PM

Type: FIX

Level: Advanced

Rated 4 stars based on 5 votes.

Article has been viewed 6,106 times.

Options
Email Article Email Article


Social Bookmarks Social Bookmarks