Click here to Skip to main content
15,881,173 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 81K   797   23  
A comparison of three WURFL ASP.NET Implementations
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Utility
{
    public class wurfl
    {

        private static string[] mc_devices = { "current device", "Mozilla/5.0 (iPhone;", "NokiaN92-2", "SAMSUNG-SGH-i900/1.0", "Nokia6600" };

        public static string[] capabilities
        {
            get
            {
                return Enum.GetNames(typeof(Capabilities));
            }
        }

        public static string[] devices
        {
            get
            {
                return mc_devices;
            }
        }

        /// <summary>
        /// The capability names used by WURFL.
        /// see: http://wurfl.sourceforge.net/help_doc.php
        /// These values must be included in the web application web.config file,
        /// if any values are added to configuration/redcircle.framework/capabilitiesWhiteList,
        /// in the format: <add capabilityName="mobile_browser"/>
        /// </summary>
        public enum Capabilities
        {
            // product_info
            mobile_browser,
            // xhtml_ui
            xhtml_support_level,
            xhtml_honors_bgcolor,
            xhtml_supports_forms_in_table,
            xhtml_support_wml2_namespace,
            xhtml_autoexpand_select,
            xhtml_select_as_dropdown,
            xhtml_select_as_radiobutton,
            xhtml_select_as_popup,
            xhtml_display_accesskey,
            xhtml_supports_invisible_text,
            xhtml_supports_inline_input,
            xhtml_supports_monospace_font,
            xhtml_supports_table_for_layout,
            xhtml_supports_css_cell_table_coloring,
            xhtml_format_as_css_property,
            xhtml_format_as_attribute,
            xhtml_nowrap_mode,
            xhtml_marquee_as_css_property,
            xhtml_readable_background_color1,
            xhtml_readable_background_color2,
            xhtml_allows_disabled_form_elements,
            xhtml_document_title_support,
            xhtml_preferred_charset,
            opwv_xhtml_extensions_support,
            xhtml_make_phone_call_string,
            xhtmlmp_preferred_mime_type,
            xhtml_table_support,
            xhtml_supports_file_upload,
            xhtml_send_sms_string,
            xhtml_send_mms_string,
            xhtml_file_upload,
            xhtml_support_iframe,
            cookie_support,
            accept_third_party_cookie,
            // css
            css_supports_width_as_percentage,
            // ajax
            ajax_support_javascript,
            ajax_support_getelementbyid,
            ajax_xhr_type,
            ajax_support_inner_html,
            ajax_manipulate_dom,
            ajax_manipulate_css,
            ajax_support_events,
            ajax_support_event_listener,
            // display
            resolution_width,
            resolution_height,
            columns,
            rows,
            max_image_width,
            max_image_height
        }

        public enum Implementation
        {
            RED_CIRCLE,
            MARGE,
            WURFL_API
        }

        public static string formatLog(double vi_ellapsed, string vs_userAgent, string vs_capability)
        {
            return vi_ellapsed + " ms - " + vs_userAgent.Split(' ')[0] + "." + vs_capability;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

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