I need to secure some files from the media-folder. Reason for this is, that I have an intranet and a website in the same umbraco-instance. Now everybody could call the pictures/files from the intranet with the domain of the website.
For this I can't use mediaprotect, because there is no use of members in this umbraco-instance
At the moment I use the following solution. And it works mostly correct:
My only problem is, that all images, which are called with ?with=xy... don't go via my route. In my opinion it just goes through the image-Cropper and thus not via my route.
So my question is: Is there a way to get into the image-Cropper-event to block images?
I think you need to create httpModule for checking access to image and place it before Umbraco modules, so you will check access before image cropper will change the image.
Securing Images from ImageCropper
Hello together,
I need to secure some files from the media-folder. Reason for this is, that I have an intranet and a website in the same umbraco-instance. Now everybody could call the pictures/files from the intranet with the domain of the website.
For this I can't use mediaprotect, because there is no use of members in this umbraco-instance
At the moment I use the following solution. And it works mostly correct:
https://martincarlsen.com/securing-media-files-in-umbraco/
My only problem is, that all images, which are called with ?with=xy... don't go via my route. In my opinion it just goes through the image-Cropper and thus not via my route.
So my question is: Is there a way to get into the image-Cropper-event to block images?
I use Umbraco 7.7.6
Hi Jeremias
I think you need to create httpModule for checking access to image and place it before Umbraco modules, so you will check access before image cropper will change the image.
What do you think about this approach?
Thanks,
Alex
Hi Alex,
Yes, that's the solution! Thank you. Now I just have one question: Is there a way to get the ApplicationContext?
That's the beginning of my HttpModule. But ApplicationContext.Current is null...
I found a solution for this :)
I tried to get Access to ApplicationContext inside the Construct. Now I put this 2 lines in the Request-Method and there it works :)
And here my Request-Method
Thank you for your post - It works. Also with Image-Cropper :)
Thanks for sharing with our community !!!
Have a great day
Thank you, too!
I also wish you a great day!!
is working on a reply...