views:

47

answers:

2

Does anyone know how to check in ASP.NET (C#) if Facebook is scraping a page? I'd like to be able to check on the server side if the "browser" hitting the page is actually Facebook (e.g. when it grabs details when a user is attempting to share a link).

A: 

Look at the referrer .... http://en.wikipedia.org/wiki/HTTP_referrer

Mawg
Referrer will not be set if Facebook servers perform direct request. It will only be set if Facebook server directs the client browser to the OP server.
Franci Penov
+6  A: 

Check whether Request.UserAgent contains Facebook.

SLaks
I checked for lowercase "facebook" and that seems to have done the trick. Let's hope Facebook don't come out with their own browser now.
soutarm