Jon Gallant's Blog

dev lead @ microsoft

Mobile Browser Detection in ASP.NET

Mobile Browser Detection in ASP.NET

  • Comments 10

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

Leave a Comment
  • Please add 5 and 1 and type the answer here:
  • Post
  • PingBack from http://www.anith.com/?p=26146

  • 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

  • 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

  • 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.

  • mayor: I believe it needs SP1.

  • When I install the browser file in the App_Browsers/Devices folder in my project the file works file.  The problem I am having is some of the properties change in XP Pro.  The properties are Id, MinorVersionString, Platform, JavaApplets, ScreenCharactersWidth, ScreenCharactersHeight, ScreenPixelsWidth, ScreenPixelsHeight, ScreenBitDepth, InputType, and CanInitiateVoiceCall.  The Browser I am using is IE7.  The biggest problem I see is the Platform not being correct.

  • 51degrees.mobi Foundation API, the .NET open source is now in Codeplex. Downloads are available here 51degrees.codeplex.com/releases.

    It easily detects if the request is coming from any mobile device and redirects user to mobile landing page. It has some user friendly samples to try out.

    There is a 4 minute video on the usage of 51degrees.mobi foundation .NET open source toolkit to Enhance your existing website to contain mobile pages.

    Video (3:43 minutes): www.youtube.com/watch

  • Is this project no longer in development?  The links in your post do not lead anywhere relevant.

  • The MDBF project is not longer.  See http://51degrees.codeplex.com/ for a possible replacement.  I haven't used it though.

  • i prefer to use adaptive approach rather than redirct. is it possible to use 51degrees just for detection and not use the redirect functionality?

    if so can u show me a sample?

Page 1 of 1 (10 items)
Search