开发者

How to understand whether the visitor is Googlebot or not ? ASP.net

How to understand whether th开发者_StackOverflow社区e visitor is Googlebot or not ? ASP.net 4.0 & C#

I mean i want to understand that if the visitor is Googlebot or not.


if (Request.UserAgent.IndexOf("Googlebot") != -1)
{
  // google!
}

I think, according to the headers supplied by this website


You need to check the request headers

Each time something requests your website it gives up some information itself, as per @Brads answer you're checking whether whatever is requesting your site is calling itself 'Googlebot'. Of course this can be a lie - so you can't place any great trust within this value.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜