I'm receiving an error when I click on a link to a PDF that's being generated by a web service. I don't know exactly how the web service is building the file other than the fact that I'm passing in the output path as a parameter:
Dim strPDF As String = Server.MapPath("~") & "\PDFs\"
obj.callService(strPDF)
I'd like to provide the user with a clickable link to the PDF. Originally, I received an error when calling the web service saying Access to the path is denied.
After Googling around, I read to add Full Control permission to the folder for NETWORK USER. I did so and now the web service creates the PDF just fine.
When I create the link to the file and click on it in the browser, I receive an error.
Chrome:
ERR_EMPTY_RESPONSE
Firefox:
The connection was reset
IE:
This page can’t be displayed
Googling the error I got in Chrome takes me to a million and one suggestions about increasing request timeout length due to handling large files but none of the PDFs I've tried to create and access are larger than 175KB and most have been around 65KB. Also, I'm getting the error right away making me think it isn't even trying to serve the file.
Can anyone help me figure out what I'm doing wrong?
EDIT: It's also worth noting that everything works fine locally. The error started when I pushed everything to the server.
EDIT2: I added a .tif image file in the same folder to see what would happen and when I try to access the file in the browser, it downloads the file just fine. It doesn't display it in the browser like the PDF would, but downloads to my Downloads folder. Does that mean there's something wrong with the PDF? Or does that mean there's an issue displaying the content in the browser but not downloading to the machine?
Good grief... So, after A LOT of cursing and help from a co-worker, I found the problem.
There was an IIS setting that caused something crazy with the way PDFs were handled for all my websites.
To fix it (for IIS 6):
It reverted the .NET framework used on another website from 4.0 to 1.1 for some reason but once I got it switched back, everything was good to go.
If anyone knows what those settings are for and has a good theory about what could have happened in my situation, I'd love to hear it! :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With