[英]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. 我对诸如Rapidshare这样的文件共享站点如何检测通过下载管理器下载文件的用户感到好奇。
How do you enable an ASP.NET web application to prevent downloads from a download manager. 如何启用ASP.NET Web应用程序以防止从下载管理器进行下载。
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 ). 在PHP中,它位于数组$ _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 ). 在Dot Net中,我认为它是HttpRequest类的一部分( http://msdn.microsoft.com/zh-cn/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. 实时地,您可以向那些参数“询问”客户端类型(IE,Firefox或独立客户端)的类型,并对它做出反应,例如阻止下载。
Sites like rapidshare don't have any access to your browsers/download managers. Rapidshare之类的网站无法访问您的浏览器/下载管理器。 They find out the info about your downloads from their server according to your IP address.
他们根据您的IP地址从服务器中找到有关您下载内容的信息。
I don't think you can make any web-application which can have such permissions. 我认为您无法制作任何具有此类权限的Web应用程序。
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. 您应该尝试防止在下载管理器中出现不喜欢的行为,而不是在下载管理器本身中。
我相信引荐来源网址( 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. 大多数下载管理器还使用
Accept-Header
HTTP标头,允许部分内容下载并通过重置重新启动。 See some docs here: HTTP Status: 206 Partial Content and Range Requests 在此处查看一些文档: HTTP状态:206部分内容和范围请求
if you mean preventing resumable and multi-connection downloads you should add a Accept-Ranges:none header to your response . 如果您要阻止可恢复的下载和多连接下载,则应在response中添加一个Accept-Ranges:none标头。
In Asp.net or Asp.net MVC: 在Asp.net或Asp.net MVC中:
Response.AddHeader("Accept-Ranges", "none");
To know more about this see Accept-Ranges 要了解更多信息,请参见接受范围
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.