ASP.NET counting visitors, not bots

I have got an ASP.Net 4 web site. I'm counting visitors at background but my code counts search engine's bots too. How can I understand my client is a bot or human? I don't want to count bots.

Regards


您可以使用Request.Browser的Crawler属性来过滤搜索引擎机器人。


You could check the User Agent and then look for the Type R which is a robot or crawler.

See http://www.user-agents.org for more info.

I am sure there are cases where the bots are not following standards and you might have to one off those.


Your best bet is probably checking the client's user agent:

http://support.microsoft.com/kb/306576

There may even be a quick little library out there for .NET with a lot of well known user agents or good regexps to use. Note that some bots will send fake user agents to make it look like they're people, some people's browsers may send empty or unknown user agents, etc. But those cases should be few and far between. For the most part this should get you pretty good statistics.

链接地址: http://www.djcxy.com/p/47328.html

上一篇: 从广播接收器获取唤醒锁时的问题

下一篇: ASP.NET统计访问者,而不是机器人