Click here to Skip to main content
15,891,033 members
Articles / Web Development / ASP.NET

WURFL ASP.NET Implementations

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
15 Jan 2009CPOL5 min read 81.2K   797   23   21
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)


Written By
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? Pin
glooskeem24-Feb-10 3:38
glooskeem24-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
professionalNic_Roche25-Feb-10 10:59 
Generalcheers Pin
ninja_scroll27-Apr-09 22:57
ninja_scroll27-Apr-09 22:57 
GeneralRe: cheers Pin
Nic_Roche16-May-09 22:14
professionalNic_Roche16-May-09 22:14 
General.NET Mobile API Pin
james rosewell31-Mar-09 22:05
james rosewell31-Mar-09 22:05 
GeneralRe: .NET Mobile API Pin
Amimpat15-Nov-10 15:26
Amimpat15-Nov-10 15:26 
GeneralRe: .NET Mobile API Pin
Nic_Roche16-Nov-10 8:54
professionalNic_Roche16-Nov-10 8:54 
GeneralOfficial WURFL .NET API Pin
sommser22-Feb-09 21:23
sommser22-Feb-09 21:23 
GeneralRe: Official WURFL .NET API Pin
Nic_Roche23-Feb-09 1:26
professionalNic_Roche23-Feb-09 1:26 
GeneralA couple others to try Pin
Gene Hallman4-Feb-09 7:10
Gene Hallman4-Feb-09 7:10 
GeneralRe: A couple others to try Pin
Nic_Roche4-Feb-09 11:04
professionalNic_Roche4-Feb-09 11:04 
GeneralDevice Atlas Pin
Chris van Renen21-Jan-09 2:21
Chris van Renen21-Jan-09 2:21 
GeneralRe: Device Atlas [modified] Pin
Nic_Roche21-Jan-09 9:20
professionalNic_Roche21-Jan-09 9:20 
GeneralRe: Device Atlas Pin
Adrian Hope-Bailie9-Feb-09 10:55
Adrian Hope-Bailie9-Feb-09 10:55 
Hi Nic,

First off, I work for dotMobi and am the lead developer of the DeviceAtlas API, that's the disclaimer out of the way.

I wanted to fill you in on the facts re DeviceAtlas. I don't want to go into a hard sell but rather to encourage you to do some impartial testing of our API vs WURFL, we had one user on the mobiForge.com forums who did one last year that generated some healthy debate around the two systems however his tests were with the Java API, and the old one at that Smile | :)

We have recently released v2.3 of our API as a Beta and hope to have it thouroughly tested and released officially in the next month or so. I'd encourage you to download it and try it out, http://deviceatlas.com/downloads/beta.
(Yes, you do need to register to download Smile | :) Your membership is shared with all our sites by the way, I'm sure you'd be a valued contributor at mobiForge)

The download comes with a sample data file that you can use for your tests. The data in the sample file was generated in late January so should be relatively up to date. It is a new format that will become official when the API does as it includes data about UA Profile headers and allows you to add these to your API queries. We have found this greatly improves the accuracy of your queries, especially when the device uses a generic UA like many Windows Mobile devices and Blackberrys.

A few general points to note:

1. The developer licence available on our site is FREE and valid for only one year but is NOT limited in any way. The data you get and the API you download are exactly what you get with a paid licence. We just trust you to be honest and buy a licence if you use DeviceAtlas commercially.

2. The number of properties we have is smaller than WURFL, however we have chosen the set of properties we offer carefully based on user feedback to:
a) Not bloat the data with properties that you don't need and mostly have no data for
b) Offer the properties that developers tell us are important.

We regularly add new properties that are requested by our users. If we don't have a good data source for them we create tests on our test suite at deviceatlas.mobi (Also ta-da.mobi). Every person that visits deviceatlas.mobi with a mobile phone completes a set of tests that help us gather data about their device.

3. Our data is distributed as a JSON file for a few reasons:
a) Speed, it parses very quickly.
b) Size, the data file is much smaller than it would be if we used XML and as a result improves the speed.
c) Layout, our data is structured in a special tree structure allowing it to be searched very efficiently without the need for regular expressions. There is no need for developers to look into or even understand the data structure, that's what the API is for Wink | ;)

4. We have numerous data sources. The most powerful of which is our test suite, deviceatlas.mobi, which I have already mentioned. Users are also able to manually submit data via our web interface. Other sources include WURFL itself, data from numerous operators and manufacturers and other valueable partners such as Volantis. What we try to do with DA is pull all of these sources together and distill the data such that we get the best and most accurate dataset. Each source has gradings based on our confidence in their data and as such conflicts are resolved based on this. These weightings constantly change as we reassess our sources and compare their data to the data we receive elsewhere.

So there you go, DeviceAtlas in a very big nutshell Smile | :)

One of the new features we're particularly happy about with the new .NET API, and one I'd REALLY appreciate your feedback on, is the IIS module that is now part of the new API. It plugs into any ASP.NET app and suppliments the existing Request.Browser object with the up-to-date data from DeviceAtlas.

Feel free to contact me if you have any questions Wink | ;)
GeneralRe: Device Atlas Pin
Nic_Roche9-Feb-09 12:54
professionalNic_Roche9-Feb-09 12:54 
GeneralRe: Device Atlas Pin
Adrian Hope-Bailie9-Feb-09 23:12
Adrian Hope-Bailie9-Feb-09 23:12 
GeneralThanks! Pin
dasefx15-Jan-09 20:53
dasefx15-Jan-09 20:53 
GeneralRe: Thanks! Pin
Nic_Roche16-Jan-09 0:13
professionalNic_Roche16-Jan-09 0:13 
GeneralRe: Thanks! Pin
dasefx16-Jan-09 23:31
dasefx16-Jan-09 23:31 
GeneralRe: Thanks! Pin
Nic_Roche17-Jan-09 0:20
professionalNic_Roche17-Jan-09 0:20 
GeneralRe: Thanks! [modified] Pin
Nic_Roche7-Feb-09 2:35
professionalNic_Roche7-Feb-09 2:35 

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

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