Internet explorer 我的网站被爬虫攻击了吗

Internet explorer 我的网站被爬虫攻击了吗,internet-explorer,http,browser,web-crawler,Internet Explorer,Http,Browser,Web Crawler,我已经创建了我的网站,比如说abc.com,我使用这个网站通过facebook、twitter和带有一些查询字符串的电子邮件进行共享。 在facebook、twitter或电子邮件上单击此链接时,网站abc.com会记录网站查看活动 在facebook和twitter上发布广告时,abc.com收到了crawler的点击,并记录了websiteview活动。所以我写了这段代码来检查iscrawler请求。 现在的问题是此代码不适用于Internet explorer。(Request.urlRe

我已经创建了我的网站,比如说abc.com,我使用这个网站通过facebook、twitter和带有一些查询字符串的电子邮件进行共享。 在facebook、twitter或电子邮件上单击此链接时,网站abc.com会记录网站查看活动

在facebook和twitter上发布广告时,abc.com收到了crawler的点击,并记录了websiteview活动。所以我写了这段代码来检查iscrawler请求。 现在的问题是此代码不适用于Internet explorer。(Request.urlReferer为空)

//
///检查是否通过爬网请求/电子邮件/社交网络发送请求
/// 
/// 
私有bool isCrawlerRequest()
{
试一试{
//任何来自facebook或twitter的手动点击都会发送URLreferer,而爬虫程序不会发送URLreferer。
因此,如果URLReferrer丢失了,我们可以认为它是一个爬虫。但是从邮箱中手动点击也不发送URLJoever,尽管它们确实有查询字符串PARAM“Strase= email”。因此,如果URLReferrer和UTMYSoad两者都不见了,我们假设它是一个爬虫。
//此外,任何正确的用户代理都不会包含“.com”、“www.”、“http:”。只有crawller用户代理包含此类文本
bool urlreferer=false;
if(Request.urlReferer!=null)
如果(!string.IsNullOrEmpty(Request.urlReferer.OriginalString))
URLreferer=true;
if(urlreferer | |(!urlreferer&&(string.Equals)(源,“email”,StringComparison.CurrentCultureIgnoreCase))
&&!UIHelper.Contains(Request.UserAgent,“.com”,StringComparison.OrdinalIgnoreCase)
&&!UIHelper.Contains(Request.UserAgent,“www.”,StringComparison.OrdinalIgnoreCase)
&&!UIHelper.Contains(Request.UserAgent,“https:”,StringComparison.OrdinalIgnoreCase)
&&!UIHelper.Contains(Request.UserAgent,“http:,StringComparison.OrdinalIgnoreCase))
{
返回false;
}
}
捕获(例外情况除外)
{                
}
返回true;
}  

好吧,缺少Referer标头根本不是确定某个客户端是爬虫程序的有效测试。您选择了一种不会导致解决方案的方法。对不起,应该是什么合适的解决方案?我搜索了解决方案,但没有得到任何好的解决方案。根本没有可靠的方法来区分“爬虫程序”和“正常”客户端。这仅仅是因为爬虫程序是一个普通的web客户端。你可以尝试实施各种检测策略,但你永远不会得到可靠的解决方案。最好的办法是评估爬虫程序或机器人在请求中如何调用自己,所以将其与已知机器人的名称列表进行比较。这样,你至少可以在一个合适的时间内检测已知机器人你将永远无法检测到不想被检测到的机器人(或“爬虫”)。
    /// <summary>
    /// Check whether the request via Crawl request / email / social network
    /// </summary>
    /// <returns></returns>
    private bool isCrawlerRequest()
    {
        try{

        //any mannual click from facebook or twitter sends URLReferrer while crawlers do not send URLReferrer. 
        //Therefore if URLReferrer is missing then we can consider it a crawller. But Manual click from mail boxes also do not send URLReferer though they do have Query String Param "Source= email". So if URLReferrer and Utm_Source both are missing, we are assuming that it is a crawller.
        //Also, any correct UserAgent would not contain ".com", "www.", "http:". Only crawller User agents contain such text
        bool urlReferrer = false;
        if (Request.UrlReferrer != null)
            if (!string.IsNullOrEmpty(Request.UrlReferrer.OriginalString))
                urlReferrer = true;

        if (urlReferrer || (!urlReferrer && (string.Equals(Source, "email", StringComparison.CurrentCultureIgnoreCase))
                && !UIHelper.Contains(Request.UserAgent, ".com", StringComparison.OrdinalIgnoreCase)
                && !UIHelper.Contains(Request.UserAgent, "www.", StringComparison.OrdinalIgnoreCase)
                && !UIHelper.Contains(Request.UserAgent, "https:", StringComparison.OrdinalIgnoreCase)
                && !UIHelper.Contains(Request.UserAgent, "http:", StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }
        }
        catch (Exception ex)
        {                
        }
        return true;
    }