Prevent image access...

Hi,

I want to be able to prevent users from viewing images on my webserver (IIS6) using direct URLs e.g. www.mysite.com/img/treehugger.jpg should not be accesible.

Now, I have read about various methods to prevent hot-linking  etc etc.

One of which involves setting wildcard in IIS6 and redirecting every request to ASP.

However, I found that when I do this I cannot then redirect the user to the image after checking (referr check etc) because asp is handling it (loop scenario?).

Anyway, my set up is as follows:

1) I have a few web app directories which use images from my img (image) directory. The image directory is a virtual mapping to a folder on harddisk and it sits in the root along with web apps which need to access the images.

2) IIS version is 6 (upgrade I know, i know!)

I can think of two ways:

Is it possible to set up so that....

Any attempt to access www.mysite.com/img/treehugger.jpg would redirect to another page which checks for cookie, if cookie present then display image otherwise block.

thanks for your help.


KS
LVL 11
Ramesh SrinivasTechnical ConsultantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Amandeep Singh BhullarCommented:
You can restrict the same using IHttpHandler,

Check the articles for details
http://www.codeproject.com/KB/web-security/HttpHandlersInAspNet.aspx
http://www.codeproject.com/KB/web-security/imagehandler.aspx

Hope this will help you
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ramesh SrinivasTechnical ConsultantAuthor Commented:
Ah, never thought of removing the virual directory and reading from filestream. Hopefully this will not create any side-effects.

thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.