Secure Image

Secure Image  In this post we will secure image /files  from being accessed by anonymous users.
In 2.0 web.config  we will add 6 lines of code.
 Scenario: I have stored all images in images folder found at the root. I will add below web.config file to my images folder.
It will let the users who are in role Editor of  site to access and it will ban anonymous users . 
 <?xml version=
                  <deny users=
                  <allow roles="Editor"/>

Eventually, whatever you store inside the images folder will not be accesible to users who are not in role Editor.

To see how we can use membershipprovider based model please refer


asp net image Convert String To Convert Image To Base64Jquery image click eventSecure ImageASP net Write Text On Image and programHow to check image is loaded using JQueryJQuery how to change background imageDiv Background ImageLoad images fasterDo you want to view only the webpage content that was delivered securely


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.