Answered by:
disable a user from browsing images in an asp.net website.

Question
-
User1227914298 posted
Hi All,
how to disable a user from browsing images in an asp,net website.
I hav a site.In the images folder there are some confidential images.now users can browse it through browser just by entering path.how to disable user from accessing it.
Any help on this is highly appreciated.
Thanks,
Anoop.
Monday, May 6, 2013 10:15 PM
Answers
-
User551462331 posted
I hav a site.In the images folder there are some confidential images.now users can browse it through browser just by entering path.how to disable user from accessing it.
for this, u have to hide the path of image... so, instead of directly specifiying the image path in image control use the dedicated image handler file.
so, u will not write this... <asp:Image ImageUrl="Images/imagename.jpg" .. />
insteda, use this... <asp:Image ImageUrl = "ImageHandler.aspx?imagename=imagename.gif" ../>
now, ImageHandler.aspx (this can also be .ashx file) will retrive imagename.jpg from image location on server and send the image as a output stream... like explaiend here
so that actual image path is not displayed to user or in browser view source
hope this helps...
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, May 6, 2013 10:41 PM -
User44562928 posted
Refer below URL,
http://www.codeproject.com/Articles/6814/Securing-image-URLs-in-a-website
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, May 7, 2013 2:13 AM
All replies
-
User551462331 posted
I hav a site.In the images folder there are some confidential images.now users can browse it through browser just by entering path.how to disable user from accessing it.
for this, u have to hide the path of image... so, instead of directly specifiying the image path in image control use the dedicated image handler file.
so, u will not write this... <asp:Image ImageUrl="Images/imagename.jpg" .. />
insteda, use this... <asp:Image ImageUrl = "ImageHandler.aspx?imagename=imagename.gif" ../>
now, ImageHandler.aspx (this can also be .ashx file) will retrive imagename.jpg from image location on server and send the image as a output stream... like explaiend here
so that actual image path is not displayed to user or in browser view source
hope this helps...
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, May 6, 2013 10:41 PM -
User1227914298 posted
Thanks KK! Will try this one. :)
Tuesday, May 7, 2013 1:52 AM -
User44562928 posted
Refer below URL,
http://www.codeproject.com/Articles/6814/Securing-image-URLs-in-a-website
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, May 7, 2013 2:13 AM