开发者

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

开发者 https://www.devze.com 2023-01-29 23:03 出处:网络
I am curious as to how the file sharing sites like rapidshare detect users downloading files through downloa开发者_运维问答d managers.

I am curious as to how the file sharing sites like rapidshare detect users downloading files through downloa开发者_运维问答d 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.


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.


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.


I believe referrer ( http://en.wikipedia.org/wiki/HTTP_referrer ) could be used as another cheap check to see where download is initiated.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消