Click here to Skip to main content
11,577,258 members (52,816 online)
Click here to Skip to main content

WURFL ASP.NET Implementations

, 15 Jan 2009 CPOL 47.2K 717 23
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.

You may also be interested in...

Comments and Discussions

 
QuestionHow can I get the whole list of user agent in the combobox? Pin
glooskeem24-Feb-10 3:38
memberglooskeem24-Feb-10 3:38 
AnswerRe: How can I get the whole list of user agent in the combobox? Pin
Nic_Roche25-Feb-10 10:59
memberNic_Roche25-Feb-10 10:59 
Generalcheers Pin
ninja_scroll27-Apr-09 22:57
memberninja_scroll27-Apr-09 22:57 
GeneralRe: cheers Pin
Nic_Roche16-May-09 22:14
memberNic_Roche16-May-09 22:14 
General.NET Mobile API Pin
james rosewell31-Mar-09 22:05
memberjames rosewell31-Mar-09 22:05 
GeneralRe: .NET Mobile API Pin
Amimpat15-Nov-10 15:26
memberAmimpat15-Nov-10 15:26 
GeneralRe: .NET Mobile API Pin
Nic_Roche16-Nov-10 8:54
memberNic_Roche16-Nov-10 8:54 
GeneralOfficial WURFL .NET API Pin
sommser22-Feb-09 21:23
membersommser22-Feb-09 21:23 
GeneralRe: Official WURFL .NET API Pin
Nic_Roche23-Feb-09 1:26
memberNic_Roche23-Feb-09 1:26 
GeneralA couple others to try Pin
Gene Hallman4-Feb-09 7:10
memberGene Hallman4-Feb-09 7:10 
GeneralRe: A couple others to try Pin
Nic_Roche4-Feb-09 11:04
memberNic_Roche4-Feb-09 11:04 
GeneralDevice Atlas Pin
Member 414449521-Jan-09 2:21
memberMember 414449521-Jan-09 2:21 
Have you had a look at Device Atlas? If so, how does it compare to the other Wurfl implementations?
GeneralRe: Device Atlas [modified] Pin
Nic_Roche21-Jan-09 9:20
memberNic_Roche21-Jan-09 9:20 
GeneralRe: Device Atlas Pin
Adrian Hope-Bailie9-Feb-09 10:55
memberAdrian Hope-Bailie9-Feb-09 10:55 
GeneralRe: Device Atlas Pin
Nic_Roche9-Feb-09 12:54
memberNic_Roche9-Feb-09 12:54 
GeneralRe: Device Atlas Pin
Adrian Hope-Bailie9-Feb-09 23:12
memberAdrian Hope-Bailie9-Feb-09 23:12 
GeneralThanks! Pin
dasefx15-Jan-09 20:53
memberdasefx15-Jan-09 20:53 
GeneralRe: Thanks! Pin
Nic_Roche16-Jan-09 0:13
memberNic_Roche16-Jan-09 0:13 
GeneralRe: Thanks! Pin
dasefx16-Jan-09 23:31
memberdasefx16-Jan-09 23:31 
GeneralRe: Thanks! Pin
Nic_Roche17-Jan-09 0:20
memberNic_Roche17-Jan-09 0:20 
GeneralRe: Thanks! [modified] Pin
Nic_Roche7-Feb-09 2:35
memberNic_Roche7-Feb-09 2: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.150603.1 | Last Updated 15 Jan 2009
Article Copyright 2009 by Nic_Roche
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid