views:

433

answers:

6

I have a website with a lot of large files. However, I want don't want users to start downloading like 10 files at a time. I noticed there are website out there where they only allow 2 simultaneous downloads.

My website is programmed using ASP.net running on IIS. Does anyone know how I can limit simultaneous downloads?

A: 

Do you want to do it programatically? Otherwise I believe there is a setting for max conncurrent connections from an ip address for IIS.

James Deville
+1  A: 

I think the only problem with max concurrent in IIS is it might block page requests rather than just download requests.

I'd say write an HTTP Handler which actually does the download and can then decide (based on IP or Cookie) if a download is allowed to be sent back to the browser. Pretty straight forward code I'd think.

typemismatch
A: 

Either way works. Personally, I'd like to know how to do it both ways, since I'm sure there are pros and cons to each method. So, whatever answer you can give me would be appreciated. If it can be done in a cookie, I wouldn't mind using that method either.

A: 

I think the only problem with max concurrent in IIS is it might block page requests rather than just download requests.

I'm no IIS expert but, if this setting is per domain / virtual host, you are set. If you can serve your downloads from a sub-domain that isn't used for anything, the setup it will not interfere with browsers that fetch several page elements at once.

Cory R. King
A: 

Can I use session state in ASP.net to do this? My users will be authenticated to use my website.

A: 

The Dynamic IP Restrictions module from Microsoft (currently in beta) will do this.

For details and a download: http://www.iis.net/download/DynamicIPRestrictions

TorgoGuy