Copied to clipboard

Flag this post as spam?

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

  • David Armitage 243 posts 923 karma points
    Jan 29, 2020 @ 00:51
    David Armitage

    Umbraco 7 | Authorization on Media Items | Restrict specific media to members only

    Hi Guys,

    I have a requirement to restrict specific media items from been opened by non members.

    I have already made a start by.

    1. Creating a restricted folder within the media which I intend to pop all the restricted media.

    2. I I've created a dynamic robots.txt to disallow search engines from indexing these types of documents.

    I now need to figure out how to restrict access to these files unless a member is logged in. I'm guessing I need to somehow hijack the route to these files and add some authorisation checks somewhere in between. I am thinking it might actually be better to add a custom property on the media item to enable and disable restricted access.

    Has anyone done anything like this before with Umbraco 7 and might have some code to share? I'm looking for any tips on the who route hijack and authorisation part.

    Thanks in advanced.


  • Dennis Adolfi 1068 posts 6327 karma points MVP c-trib
    Jan 29, 2020 @ 05:55
    Dennis Adolfi

    Hi David. I’ve done something like this before, using a custom HttpHandler that intercepted the media file request and validate. In my case I didn’t validate on a member group but instead I needed to validate against an external auth provider, but I guess the principal is the same.

    Have a look at this blog post, it’s probably at least half of what you are looking for:

    Best of luck! Cheers

  • David Armitage 243 posts 923 karma points
    Jan 29, 2020 @ 06:02
    David Armitage

    Hi Dennis,

    Just want I am looking for. Thanks

Please Sign in or register to post replies

Write your reply to: