Friday, April 3, 2009

Mobile Browser Detection in ASP.NET

Before last week the only two viable Mobile Browser Detection options were:

  1. WURFL – Great for non-.NET solutions. .NET APIs lack support
  2. DeviceAtlas – Great for .NET solutions, but it’s starts at $99/server/year. DeviceAtlas claims to have better UAProf support than WURFL.

To solve this problem Microsoft developed an ASP.NET friendly browser detection solution using a standard “.browser” file called “Mobile Device Browser File" or MDBF. This is the same solution that is being utilized by many Microsoft properties such as Hotmail.

Chris Woods (the MDBF PM) gave a talk at MIX09 on the new project, view the video here: http://videos.visitmix.com/MIX09/T85M. The data for MDBF comes from WURFL and “other sources”. I hope Microsoft contributes back to WURFL since they have direct access to providers they will have a ton of insight into new devices and capabilities that non-.NET platforms utilizing WURFL will benefit from.

To implement MDBF in your ASP.NET application:

  1. Download the mobile.browser file from mdbf.codeplex.com
  2. Add the file to your ASP.NET web app here: App_Browsers/Devices/mobile.browser
  3. Use the standard Request.Browser[“PropertyName”] to access the new properties

Jon Gallant

dev lead @ microsoft