Last post Jun 28, 2018 06:39 AM by KathyW
Jun 28, 2018 05:50 AM|dhamuS|LINK
I want to prevent virtual directory access to directly in browser. i have image, PDF etc in my virtual directory to access from website.
i want to restrict from browser https://mywebsite/virtual directory name/image.jpg and should allow the image in page like <image src="https://mywebsite/virtual directory name/iamge.jpg"/>
<add segment="virtual directory name" />
but it is restrict both inside website and browser. Please help us how can i implement this functionality.
Thanks in Advance,
Jun 28, 2018 06:20 AM|KathyW|LINK
The browser needs access to your image link in order to display it. You can't have it both ways. I'll mention that when you link to an image in the page, the visitor already has a downloaded copy of that image in their browser cache, so there is no additional
security achieved by trying to block direct access to the image.
… So, what is your goal? That would help with suggestions, if any. For example, if you are trying to protect images from being downloaded, you could base64 encode all the images used in your site, and not link to them. It's a bit of a hassle, and generates
quite a lot of page markup for large/complex images.
Jun 28, 2018 06:33 AM|dhamuS|LINK
In my virtual directory contains not only image. i have files also like pdf, xls etc.. you think it is not possible to achieve both ways using link?.
Please let us know is there any other way?
Jun 28, 2018 06:39 AM|KathyW|LINK
I don't know any other way. What is the issue you are trying to solve, since visitors to your site can see those documents on your pages, anyway, presumably.