Web.config

M

Maziar Aflatoun

Hi everyone,

I have created a Web.config file that when users try to access any .aspx
file in the /protected folder redirects them to a login page. But this
doesn't work for .jpg, .zip...etc. How can I change that? Also, I don't have
access to the remote hosting IIS admin. So, it has to be done in Web.config.
Is that possible to enable authentication for .zip, .jpg...etc.

Thanks
Maz.
 
P

Peter Rilling

Forms authentication only works with files that are processed by the
aspnet_isapi.dll. As you might have guessed, images and other non-ASP.NET
files are not processed by this filter. So, to solve this problem, you
would either need to use IIS to protect the folder, or make it so that
images are processed by the ASP.NET filter. Both require changes to the IIS
box. Since you do not have access to IIS, then there is nothing that can be
done (that I know of).
 
V

vMike

Maziar Aflatoun said:
Hi everyone,

I have created a Web.config file that when users try to access any .aspx
file in the /protected folder redirects them to a login page. But this
doesn't work for .jpg, .zip...etc. How can I change that? Also, I don't have
access to the remote hosting IIS admin. So, it has to be done in Web.config.
Is that possible to enable authentication for .zip, .jpg...etc.

Thanks
Maz.
Here is one possible way at least for image file. If your images are in a
directory above you web root (make sure aspnet has rights) or in a database,
you can stream them out from a aspx file by saving to the
response.outputstream or some kind of binary write. Therefore the user must
call the aspx file to get to the image. You could probably do the same with
zip files. This may give you some ideas anyway.

Mike
 

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
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top