how to restrict image folder from direct access
-
Hi All, I've a image gallery website where members can upload and restrict the access to few friends. The problem is, images are directly accessible from browser. How could I restrict specific folder to accessible from aspx pages only. Regards, Neeraj
-
Hi All, I've a image gallery website where members can upload and restrict the access to few friends. The problem is, images are directly accessible from browser. How could I restrict specific folder to accessible from aspx pages only. Regards, Neeraj
I have done similar to this.. I have used a webservice to get the path of the requested images from an encrypted session guid which is created during login...
Abhishek Sur
-
Hi All, I've a image gallery website where members can upload and restrict the access to few friends. The problem is, images are directly accessible from browser. How could I restrict specific folder to accessible from aspx pages only. Regards, Neeraj
Neeraj Arora wrote:
How could I restrict specific folder to accessible from aspx pages only
Write a http handler which handles requests for images. Check the authentication and display necessary messages. Make sure you map the extensions to ASP.NET in IIS settings.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
Neeraj Arora wrote:
How could I restrict specific folder to accessible from aspx pages only
Write a http handler which handles requests for images. Check the authentication and display necessary messages. Make sure you map the extensions to ASP.NET in IIS settings.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
Thanks for reply but I'm not aware how to write this type of handler. Could you help me for a sample. Rgds, Neeraj
-
I have done similar to this.. I have used a webservice to get the path of the requested images from an encrypted session guid which is created during login...
Abhishek Sur
Thanks for the reply. When I show image, anybody can check the relative path from viewsource and try other photos from same folder. Please correct me if I'm wrong or I understood your reply wrongly. Rgds, Neeraj
-
Hi All, I've a image gallery website where members can upload and restrict the access to few friends. The problem is, images are directly accessible from browser. How could I restrict specific folder to accessible from aspx pages only. Regards, Neeraj
There are two ways of doing this - an easy "hack" and a "proper" way... The easy way is simply to save your images with randomly assigned (GUID-type thing) filenames which can't be guessed. This doesn't stop people linking directly to your images once they know the filename of course, but unless your images are highly popular that is unlikely to be a problem, but it will stop them from finding images until you reveal the address. The proper way is to write a custom handler; you can find an example here[^]. Note though that depending on your version of IIS you may need to perform some steps differently - that article assumes IIS6; once you get above this you need to write your config file differntly, for one thing...
-
Thanks for reply but I'm not aware how to write this type of handler. Could you help me for a sample. Rgds, Neeraj
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
Thanks buddy.