简体   繁体   中英

IIS 7.5 404 Error for .PDF files

I am running into an issue where I am re-directing a .pdf extension url using IIS 7.5. Here is what is weird happening: When my URL does not contains .pdf in it like: http://mySite/documents/forms/test the pdf (test.pdf) opens up perfectly. However, when I am opening through like this: http://mySite/documents/forms/test.pdf it is showing me

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

I browse through couple of links like: http://chentiangemalc.wordpress.com/2012/02/16/case-of-the-disappearing-pdf/

and

http://support.microsoft.com/kb/979543

But dont know whether they are appropriate. Also tried debugging through fiddler as this link mentioned: http://chentiangemalc.wordpress.com/2012/02/16/case-of-the-disappearing-pdf/

When I am saving the Response Body the pdf file does not get saved in correct format. So I am guessing there is some kind of file corruption? Maybe? But my file opens up perfectly when I do not include the .pdf in the URL. Dont know what is going on :\\

I got the answer. I have to change the web.config file to allow .pdf file to open in the browser:

 <preprocessRequest help="Processors should derive from Sitecore.Pipelines.PreprocessRequest.PreprocessRequestProcessor">
    <processor type="Sitecore.Pipelines.PreprocessRequest.SuppressFormValidation, Sitecore.Kernel" />
    <processor type="Sitecore.Pipelines.PreprocessRequest.NormalizeRawUrl, Sitecore.Kernel" />
    <processor type="Sitecore.Pipelines.PreprocessRequest.IIS404Handler, Sitecore.Kernel" />
    <processor type="Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions, Sitecore.Kernel">
      <param desc="Allowed extensions (comma separated)">aspx, ashx, asmx, pdf</param>
      <param desc="Blocked extensions (comma separated)">*</param>
      <param desc="Blocked extensions that stream files (comma separated)">*</param>
      <param desc="Blocked extensions that do not stream files (comma separated)" />
    </processor>
    <processor type="Sitecore.Pipelines.PreprocessRequest.StripLanguage, Sitecore.Kernel" />
  </preprocessRequest>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM