tags:

views:

98

answers:

2

I have a system that allows the users to download some files, the user needs to login first and then he is autorized or not to download. The download page is Download.aspx?FileId=42 and the code within this page opens the file and keeps sending small chunks to the user. We made this because we needed to guarantee that only authorized users could download.

We recently moved this system to IIS7 and it is working properly, but I don't like the idea of having a custom c# code sending the chunks to the client, so I would like to know if there is a way of when a request to file.zip is made, a custom code is executed to authorize or not, and if it is authorized, I just tell IIS7 to proceed the download instead of running the code inside Download.aspx.

Is this possible?

Thanks!

A: 

Do a redirect to the zip file. Hide the zip file in a obscure location with non-regular naming. "Security through obscurity."

Daniel A. White
the problem with this is that no matter what you do, using httpwatch for instance lets the user know the location of the zip file.
True, but if its non standard naming, then people could not find the other ones.
Daniel A. White
this would be the last option... thanks for your help!
What an incredibly bad idea, redirects are easily visible
blowdart
A: 

IIS7 has authorization that uses Forms or Windows authentication for all file types - if it's running in integrated pipeline mode. The syntax is just like that for ASP.NET applications, but it's in a different place in web.config, <system.web>. The rules can also be added using the IIS7 admin interface. There are a couple of differences, IIS7 URL authorization evaluates rules from the parent down and deny rules take precedence.

blowdart