Role based access to photos (jpeg files)?

O

Olav Tollefsen

I need to role based access to photo files stored on a Windows Server 2003
based web server. The user should only be given access to certain files
stored on the web server provided that some application logic grants access
to the files (could be single files in a directory where multiple files are
stored).

How can this be done?

Olav
 
D

David Coe

Olav

You can grant access to files on a file by file basis or by directory. In the web.config file, just outside of the <system.web> element, enter

<location path="jpegFolderName"><system.web><authorization><allow users="allowedUserName" /><deny users="?" /></authorization></system.web></location>
 
O

Olav Tollefsen

I can't do it statically as suggested below. I MUST be able make decisions
in the code weather to allow access or not.

Olav

David Coe said:
Olav -

You can grant access to files on a file by file basis or by directory. In
the web.config file said:
<location path="jpegFolderName"><system.web><authorization><allow
users="allowedUserName" /><deny users="?"
/></authorization></system.web></location>
 
J

Joe Kaplan \(MVP - ADSI\)

Would you consider writing an HttpHandler to do this for you? It is easier
than you might think to write some .NET code that returns images back to the
browser and the ability to write code to authorize the request would seem to
provide you with what you need.

The big decision then would be whether you would use the .ashx extension for
your handler as it typical of custom handlers or if you would remap the IIS
metabase to point .jpg files to .NET and write a custom handler for .jpg
files. Either way would work. It depends more on how the URL needs to look
to the consumer. The .ashx is easier to deploy since it doesn't require
changing the IIS metabase.

Joe K.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,133
Messages
2,570,776
Members
47,334
Latest member
danialcarter

Latest Threads

Top