Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Brian 3 posts 23 karma points
    May 14, 2013 @ 16:21
    Brian
    0

    Umbraco: Deny public access for media files of content

    I'm working with Umbraco 4.11.8.

    For my website I have a document type, that contains a field to upload PDF files. The created content items of this document type aren't public so a specific membergroup can see them, only. That works fine.

    But... When I type the specific path of the PDF file in the browser, it will show me, but it shouldn't. It just has to be visible for logged in members.

    Is there a way to do this with umbraco or do I have to do this with the webserver (IIS 7) and the web.config? I'm able to deny the access of all media files in the media folder, but there are images and files for public, too. So that isn't the solution.

  • Ken Dimmer 13 posts 72 karma points
    May 28, 2013 @ 20:53
    Ken Dimmer
    0

    I would be curious if someone has a way to do this in Umbraco, but you can do this in IIS. You need to notify IIS to send the request for .pdf extension to .net by adding mappings in IIS. You also may need to add HttpHandlers in your web.config or machine.config. Example:

     <configuration>
      <system.web>
         <httpHandlers>
            <add verb="*" path="*.pdf" type="System.Web.UI.PageHandlerFactory System.Web"/>
         </httpHandlers>
      </system.web>
    </configuration>

    Ken- Fyin.com

Please Sign in or register to post replies

Write your reply to:

Draft