Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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 use Umbraco 7.7.6
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?
Yes, that's the solution! Thank you.
Now I just have one question: Is there a way to get the ApplicationContext?
public class SafeImageLoad : IHttpModule
private IMediaService mediaService;
private IDomainService domainService;
private MyEventHandler _eventHandler = null;
mediaService = ApplicationContext.Current.Services.MediaService;
domainService = ApplicationContext.Current.Services.DomainService;
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 :)
public void Init(HttpApplication app)
app.BeginRequest += LdProtectRequest;
And here my Request-Method
public void LdProtectRequest(Object s, EventArgs e)
HttpApplication app = s as HttpApplication;
IMediaService mediaService = ApplicationContext.Current.Services.MediaService;
IDomainService domainService = ApplicationContext.Current.Services.DomainService;
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...
Write your reply to:
Image will be uploaded when post is submitted