This code snippet is show how you can determine the request is a crawler or not.
Code Behind
/// <summary>
/// Returns whether browsing device is search engine crawler (spider, bot).
/// </summary>
public bool IsCrawler()
{
if (HttpContext.Current != null)
{
HttpRequest currentRequest = HttpContext.Current.Request;
return (currentRequest.Browser != null) && currentRequest.Browser.Crawler;
}
return false;
}
You can put this method under static class and call it from Global.asax file.
By Mohd ZulkamalNOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
0 comments:
Post a Comment