Is there a way to show images for authenticated users only?
I'm using owin authentication.
I know of the ImageProcessingModule.ValidatingRequest event, but it runs only the first time an image is requested.
If the image is in cache already, it will be displayed.
Is there a way to catch and stop the cache request?
You can do nothing with web browsers cache, the only thing you can do - set an expiration time for the images something like 0. Did you mean browser cache?
I know of the ImageProcessingModule.ValidatingRequest event, but it runs only the first time an image is requested. If the image is in cache already, it will be displayed.
I don't know where you got that idea. OnValidatingRequest is called for every request.
I figured it out, what was happening was that even after setting e.Cancel to true, it would still return the image. But that image was the original from Umbraco without being processed. That's what caused the confusion.
Image protection for non authenticated users
Hello,
Is there a way to show images for authenticated users only?
I'm using owin authentication.
I know of the ImageProcessingModule.ValidatingRequest event, but it runs only the first time an image is requested. If the image is in cache already, it will be displayed.
Is there a way to catch and stop the cache request?
Has anyone solved a similar problem?
Thanks!
Hi Mário
You can do nothing with web browsers cache, the only thing you can do - set an expiration time for the images something like 0. Did you mean browser cache?
Thanks,
Alex
Hi Alex
No, I mean the imageprocessor cache.
Thanks.
I don't know where you got that idea.
OnValidatingRequest
is called for every request.https://github.com/JimBobSquarePants/ImageProcessor/blob/809f2b0763441f307c6a00ee10cea5f6cd4b9d4b/src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs#L496
The cache is not checked until after.
https://github.com/JimBobSquarePants/ImageProcessor/blob/809f2b0763441f307c6a00ee10cea5f6cd4b9d4b/src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs#L576
If in doubt always check the source.
As Alex said, you're probably seeing the result of the browser cache. There's a config setting
browserMaxDays
where you can reduce that to 0 days.Thanks James,
You are right, it is called on every request.
I figured it out, what was happening was that even after setting e.Cancel to true, it would still return the image. But that image was the original from Umbraco without being processed. That's what caused the confusion.
My solution was to abort the request.
Thanks guys, you rock! :D
is working on a reply...