Just a quick note to report status update. Seems the Facebook like user agent is not part of the
51Degrees.mobi-Lite-2012.01.18.dat file so Facebook is redirected to your mobi site when it scrapes your page.
I have a custom view engine and the
mobileHomePageUrl attribute in the redirect config element was causing problems for me and had to remove it to get the view engine working.
I have resorted to a manual hack by checking as follows:
private static bool _IsMobileDevice ()
{
var isMobileDevice = HttpContext.Current.Request.Browser.IsMobileDevice;
//HACK: issue with Facebook scraper viewing the site as MOBI site.
if (HttpContext.Current.Request.UserAgent != null)
{
{
Log("FB UserAgent");
isMobileDevice = false;
}
}
return isMobileDevice;
}