I’m running into some issues serving PDF files from my ASP.Net MVC Application.
The behaviour that I see is after linking to a PDF file in my project, I get the following errors:
In Firefox – Content Encoding Error – The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
In Chrome – Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.
As far as I know I’m not doing anything fancy with the PDF content/encoding and it’s just a standard linked Content file (similar to an jpg or png on the site which works fine).
Can anyone offer insight as to how to resolve this issue?
This ultimately turned out to be related to the default compression that I was serving my content with.
As soon as I added ‘.pdf’ to the list of files to not be compressed, my errors went away and I could happily serve PDF content as expected.
If anyone finds their way to this question via google results for the above errors, I’d take a look at how your content is being encrypted and whether that is causing problems serving PDF files in a situation similar to mine.