03 April 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

Filed under: , , ,
 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Anith » Mobile Browser Detection in ASP.NET said:

PingBack from http://www.anith.com/?p=26146

03 April 09 at 9:05 PM
# AndrewDB said:

Hi Jon,

I notice when we use the Visual Studio ASP.NET unit testing features with pages that include MDBF, when the test executes IsMobileBrowser ==  true and Type == "Unknown". It might make sense to recognize this environment as a specific browser type (or at least not indicate that it is a mobile device).

Even better would be if we could specify the browser type as an attribute of the test, so that we could write special tests targeting mobile devices.

Thanks,

Andrew

28 May 09 at 7:47 PM
# Amit Patel said:

Hi John

You can easily do this using OPEN SOURCE http://www.51degrees.mobi/Products/NETMobileAPI

This API gives detailed information of the device making the request and also has the facility to redirect user automatically to mobile specific page when request in coming from mobile device.

I have found this very useful and easy to implement in mobile website developments.

Please give a try will be very useful.

Thanks

31 July 09 at 7:28 AM
# mayor said:

Hi Jon,

Im Using the MDBF to redirect Users from my main site to the mobile versions using the Request.Browser.IsMobileDevice = True capability but i keep getting an error "the 'ParentId' attribute must be specified on the 'gateway' tag" and my project uses .net framework 3.5, could you please point out what the problem is .thank you.

29 September 09 at 5:12 AM

Leave a Comment

Comment Policy: No HTML allowed. URIs and line breaks are converted automatically. Your e–mail address will not show up on any public page.

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Page view tracker