开发者

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

开发者 https://www.devze.com 2023-02-08 11:18 出处:网络
How to understand whether th开发者_StackOverflow社区e visitor is Googlebot or not ? ASP.net 4.0 & C#

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

精彩评论

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

关注公众号