I have built a custom middleware that does what you are looking for using 9/10. Here is the post - scroll to the bottom for the most robust part of the solution.
That's great. Really happy to hear that. I do think that you might also have all your umbraco back office users unable to access those PDFs too unless they are logged in to the front-end as a member as well at the same time they are logged into the back-office. If so, there is some extra code we can add that will allow a back office user to see all media as well without restriction.
If you could mark the above as the 'solution' that would be awesome.
Restrict public access to files
Dear community,
I have "restrict public access" on specific pages on my website. In these pages I link to various files that require membership login.
However, these files can be accessed without being logged in if you have the URL.
Is it possible to restrict public access to files somehow?
At the moment it's not a standard feature of Umbraco but there is a commercial plugin available that does the job.
https://our.umbraco.com/packages/website-utilities/media-protect/
Thanks for the reply SteveV!
I have built a custom middleware that does what you are looking for using 9/10. Here is the post - scroll to the bottom for the most robust part of the solution.
https://our.umbraco.com/forum/using-umbraco-and-getting-started/108979-intercept-all-media-requests
Jamie, this is EXACTLY what I needed! I changed the close slightly to see if the URL contains .PDF and it works beautifully.
Thank you so much for coming by this thread and taking your time to provide an aswer, kudos to you.
Have a wonderful day and thank you!
That's great. Really happy to hear that. I do think that you might also have all your umbraco back office users unable to access those PDFs too unless they are logged in to the front-end as a member as well at the same time they are logged into the back-office. If so, there is some extra code we can add that will allow a back office user to see all media as well without restriction.
If you could mark the above as the 'solution' that would be awesome.
Cheers,
Jamie
is working on a reply...