Change default values

Jun 12, 2009 at 10:22 PM

We started using the mobile device browser file a few days ago to determine if our suers should be directed towards our regular or low bandwidth sites.  For this we're doing a check on Request.Browser.IsMobileDevice (and a few other things).  For 99.9% of all of our visitors this works correctly, but a bunch of search bots are getting sent to our low bandwidth site since they're showing up as a MobileDevice by this property. 

The doucmentation says that the default value for this property is true, and we'd like to set it to false for our site.  How can we modify the default value?  The documentation on MSDN about the browser file lists a node called "default," but there doesn't seem to be one in the mobile device file.  Would we do this by adding <capability name="isMobileDevice" value="false"/> to the deviceShim section?



Jun 22, 2009 at 5:36 PM

I had a similar experience.  I recently implemented the MDBF on a live site with logic to redirect visitors to the mobile site when Request.Browser[“IsMobileDevice”] is true.  However, the search engine crawlers are being identified as mobile devices.  Googlebot visited the site, was determined to be a mobile device and was redirected to the mobile version of the site.  The home page was re-indexed and now the mobile version is listed in the Google search results.

To test this, I used the Firefox extension User Agent Switcher tool and used the following user agent:


Then I went to the home page and Request.Browser[“IsMobileDevice”] is being returned as true.  This behavior is not what I expected; I would expect this property to be false for Googlebot.  Google does have a separate crawler for mobile sites, but it’s user agent is different:


Nokia6820/2.0 (4.83) Profile/MIDP-1.0 Configuration/CLDC-1.0 (compatible; Googlebot-Mobile/2.1; +


Is there a way to have crawlers recognized as NOT being mobile devices?

Jun 23, 2009 at 10:34 AM
Hi all...
I think, that default settings capabilities in thos project is VERY unsuitable, because 'default device' is mobile device with application/xhtml+xml
Unless you have any information from User-Agent, as default settings is use:
<capability name="isMobileDevice" value="true" />
<capability name="preferredRenderingMime" value="application/xhtml+xml" />
<capability name="preferredRenderingType" value="xhtml-basic" />
Jul 28, 2009 at 5:33 PM

HttpCapabilitiesBase.Crawler may be the answer?

However, I think the point about isMobileDevice defaulting to true is still a valid design concern.

Jul 30, 2009 at 10:35 PM

Using something similar to the following 4 steps "should" get you headed in the right direction for the inverse default behavior. I haven't done a lot of testing, so it's probably not complete - but is just enough to know that it feels like the right direction. Use at your own risk.

  1. Add an <capability name="isMobileDevice" value="false" /> into the <gateway id="deviceShim_seq_1" parentID="deviceShim"> capabilities section at the top of the file
  2. Change <capability name="isMobileDevice" value="true" /> to "false" for <browser id="deviceShim_seq_44"
  3. Run the following code to create a Test.xml document with the identified mobile browsers to have an <capability name="isMobileDevice" value="true" /> entry. 
  4. Replace the mobile.browser file contents with the test.xml contents and do your testing.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace FixMobileDeviceFile
	class Program
		static void Main(string[] args)
			XmlDocument doc = new XmlDocument();
			XmlNodeList browsers = doc.SelectNodes("//browser");			
			SetMobileIfIdentified(doc, browsers);

		private static void SetMobileIfIdentified(XmlDocument doc, XmlNodeList nodes)
			foreach (XmlNode node in nodes)
				XmlNodeList identityNodes = node.SelectNodes("identification/capability[@name='_support_deviceIdentity']");
				XmlNode capabilities;
				if (identityNodes.Count > 0)
					capabilities = node.SelectSingleNode("capabilities");
					if (capabilities == null)
						capabilities = doc.CreateElement("capabilities");

					XmlNode isMobile = capabilities.SelectSingleNode("capability[@name='isMobileDevice']");
					if (isMobile == null)
						isMobile = doc.CreateElement("capability");
						var name = doc.CreateAttribute("name");
						name.Value = "isMobileDevice";
						var value = doc.CreateAttribute("value");
						isMobile.Attributes["value"].Value = "true";


Nov 2, 2009 at 4:55 PM

Thanks for the code JBBrown.

I've implemented your fix as well as adding OceanSpiders.browser from  The only side affect I'm hearing about now is that some laptops and even desktops are being recognized as a mobile device and consequently are being redirected to our mobile site.  At present, I'm only checking Request.Browser.IsMobileDevice.  Should I be checking other properties as well?  Perhaps the OS/platform? 

I'd really appreciate any suggestions.