Click here to Skip to main content
Click here to Skip to main content

WURFL ASP.NET Implementations

, 15 Jan 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
A comparison of three WURFL ASP.NET Implementations
web_gui.png

Introduction

It is very well documented how the inbuilt Request.Browser object has shortcomings in the mobile web-application world (here and here). WURFL is an open-source project which succeeds in filling the void left by these problems. There are a growing number of ASP.NET implementations of WURFL. We will be discussing three of these:

  • RedCircle - An implementation that seems to have been authored by Paulo Gomes whilst working for RedCircle.
  • Wurfl.Marg - An implementation found at wurfl.marg.si and discussed at groups.yahoo.com/group/wmlprogramming.
  • wurflAPI (aka WURFL as a dotNetAPI) - An initiative of the WURFL Sourceforge project.

Background

WURFL is based on matching the user-agent string as identified by the request object (on the server), with an "ambitious configuration file that contains info about all known Wireless devices on earth" (http://wurfl.sourceforge.net/backgroundinfo.php). The resulting node is parsed into a Capabilities collection which enumerates the known properties of the mobile browser. These include groups of properties (full breakdown) like:

  • product_info - Human readable brand and model name and other generic info
  • wml_ui - User Interface for WML browser
  • chtml_ui - User Interface for Compact HTML
  • xhtml_ui - User Interface for HTML/XHTML-MP browser
  • css - CSS-issues
  • ajax - Supported Mobile Ajax features
  • markup - Supported markup languages
  • cache
  • display
  • image_format
  • bugs
  • wta
  • security
  • bearer
  • storage
  • object_download
  • drm
  • streaming
  • wap_push
  • mms
  • sms - Binary SMS and SCKL capabilities
  • j2me
  • sound_format - supported sound formats
  • flash_lite - Macromedia/Adobe Flash Lite
  • transcoding - Handle abusive transcoders
  • rss - Native support for RSS feeds
  • pdf - Native support for PDF documents

These properties can be queried for conditional rendering for different devices (implemented manually), or if Adaptive Control Behaviour is supported and mobile controls are used, the page is automatically rendered in different ways depending on the capabilities of the browser. A good practical example of Adaptive Control Behaviour is explained by Paulo Gomes formerly of RedCircle here.

The Tests

As some metrics were needed, objects that can be initialized in the Global.asx file were initialized in the page code-behind so that the processing could be timed. Also the code is not optimized in any way (do not use it in its current form); it has been designed solely to be audited (via time logs). The time results shown cannot be taken seriously in an absolute sense, but the patterns and relative values can be compared. The files were deployed to a Virtual PC with Windows XP Professional Version 2002 Service Pack 2 and IIS 5.1 running.

For the most part, I expect that the project will be browsed by desktop computers (for evaluation); the WURFL data file included doesn't have all of the desktop user-agents included and will use generic values. This in itself is a disparity with how the code will run in production as it adds lookup(s) to get the generic value.

The test plan was fairly simple; general comparisons were of interest but caching and the handling of data changes were important features to assess. The tests included:

  • Getting a property for the current device
  • Getting subsequent properties for the same device
  • Getting a property for another other device
  • Getting subsequent properties for the other device
  • Changing the data file

The test steps were:

  1. user agent: current device
    capability: mobile_browser
    data modified: false
  2. user agent: current device
    capability: xhtml_table_support
    data modified: false
  3. user agent: current device
    capability: ajax_support_javascript
    data modified: false
  4. user agent: current device
    capability: resolution_width
    data modified: false
  5. user agent: NokiaN92-2
    capability: mobile_browser
    data modified: false
  6. user agent: NokiaN92-2
    capability: xhtml_table_support
    data modified: false
  7. user agent: NokiaN92-2
    capability: ajax_support_javascript
    data modified: false
  8. user agent: NokiaN92-2
    capability: resolution_width
    data modified: false
  9. user agent: iPhone
    capability: mobile_browser
    data modified: true

The results are as follows (in milliseconds):

test_results.png

My Observations

RedCircle

  • Other than the very first load (test #1) it performed very well; most of the times were less than a millisecond. To achieve this, a capabilitiesWhiteList was added to the Web.config file.
  • On a previous test-drive of the RedCircle Framework, I asserted that there was a mechanism that reloaded the data when it was changed. In these tests, this was not the case: with test #9, none of the WURFL implementations reloaded the data when the WURFL.xml file was modified.
  • The API was easy to use although quite a lot of configuration is needed in the web.config file.
  • Although not tested in this article, the framework has a plain vanilla Adaptive Control Behaviour implementation particularly useful if outputting WML.

WURFL.Marg

  • Marg performed well across the board; test #5 result seems like an anomaly though.
  • The API is a little more complex to use, but as the Request.Browser is assigned to, the built-in Adaptive Control Behaviour is functioning based on the WURFL device list.
  • There is more tight coupling than the other implementations. Log4net must be referenced from the consuming project and there are more modifications needed in the web.config file.

wurflAPI

  • This implementation performed the worst; I'm not sure whether it is being maintained anymore, even though it is a Sourceforge project.
  • It does not seem to support Adaptive Control Behaviour.

Points of Interest

There did not seem to be any automatic mechanism in the frameworks for reloading objects on data file modification. Fortunately System.Web.Caching can monitor and reload data files with very little coding.

The team that is working on Marg (Miha Valenic seems to be a senior member) also offers a more comprehensive hosted solution for adaptive rendering; dialogs of the details can be found here.

History

  • 2009-01-16 - Article submitted

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Nic_Roche
Software Developer Encore Software
Australia Australia
Contractor in Desktop and Web applications.
Gold Coast, Queensland.

Comments and Discussions

 
QuestionHow can I get the whole list of user agent in the combobox? Pinmemberglooskeem24-Feb-10 4:38 
AnswerRe: How can I get the whole list of user agent in the combobox? PinmemberNic_Roche25-Feb-10 11:59 
Generalcheers Pinmemberninja_scroll27-Apr-09 23:57 
GeneralRe: cheers PinmemberNic_Roche16-May-09 23:14 
General.NET Mobile API Pinmemberjames rosewell31-Mar-09 23:05 
GeneralRe: .NET Mobile API PinmemberAmimpat15-Nov-10 16:26 
GeneralRe: .NET Mobile API PinmemberNic_Roche16-Nov-10 9:54 
GeneralOfficial WURFL .NET API Pinmembersommser22-Feb-09 22:23 
GeneralRe: Official WURFL .NET API PinmemberNic_Roche23-Feb-09 2:26 
GeneralA couple others to try PinmemberGene Hallman4-Feb-09 8:10 
GeneralRe: A couple others to try PinmemberNic_Roche4-Feb-09 12:04 
GeneralDevice Atlas PinmemberMember 414449521-Jan-09 3:21 
GeneralRe: Device Atlas [modified] PinmemberNic_Roche21-Jan-09 10:20 
GeneralRe: Device Atlas PinmemberAdrian Hope-Bailie9-Feb-09 11:55 
GeneralRe: Device Atlas PinmemberNic_Roche9-Feb-09 13:54 
GeneralRe: Device Atlas PinmemberAdrian Hope-Bailie10-Feb-09 0:12 
GeneralThanks! Pinmemberdasefx15-Jan-09 21:53 
GeneralRe: Thanks! PinmemberNic_Roche16-Jan-09 1:13 
GeneralRe: Thanks! Pinmemberdasefx17-Jan-09 0:31 
GeneralRe: Thanks! PinmemberNic_Roche17-Jan-09 1:20 
GeneralRe: Thanks! [modified] PinmemberNic_Roche7-Feb-09 3:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.1411022.1 | Last Updated 15 Jan 2009
Article Copyright 2009 by Nic_Roche
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid