简体   繁体   中英

How do you detect if a file is being downloaded by a Browser or a Download Manager

I am curious as to how the file sharing sites like rapidshare detect users downloading files through download managers.

How do you enable an ASP.NET web application to prevent downloads from a download manager.

When you are a server, you can receive some interesting info about the client that access you.

One of the parameters is telling you the "User Agent", or in simple words the browser type.

In PHP it's in the array $_SERVER ( http://php.net/manual/en/reserved.variables.server.php ).

In Dot Net, I think it's part of the HttpRequest class ( http://msdn.microsoft.com/en-us/library/system.web.httprequest.aspx ).

On real-time, you can "ask" those params what are the client type (IE, Firefox, or an independent client), and react to it like preventing download.

Sites like rapidshare don't have any access to your browsers/download managers. They find out the info about your downloads from their server according to your IP address.

I don't think you can make any web-application which can have such permissions.

What do you want to prevent? A download-manager isn't evil by itself.

How do you even define a download manager? Every web-browser has an integrated download-manager of varying quality.

You should try to prevent the behavior you don't like in download-managers, and not download-managers themselves.

  • You can prevent automated downloads using captchas(but might not always work and annoys users)
  • And you can prevent multiple downloads in parallel by allowing only one download per IP.

我相信引荐来源网址( http://en.wikipedia.org/wiki/HTTP_referrer )可以用作另一个廉价的检查,以查看在何处启动下载。

Most of the download managers also use the Accept-Header HTTP header allowing partial content download and restart over resets. See some docs here: HTTP Status: 206 Partial Content and Range Requests

if you mean preventing resumable and multi-connection downloads you should add a Accept-Ranges:none header to your response .

In Asp.net or Asp.net MVC:

Response.AddHeader("Accept-Ranges", "none");

To know more about this see Accept-Ranges

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM