Export (0) Print
Expand All
0 out of 3 rated this helpful - Rate this topic

deviceFilters Element (ASP.NET Settings Schema)

Specifies a device or a device class in the ASP.NET MobileCapabilities system based on the user agent or browser. A device filter can be used by a page or application developer to override control properties or to define blocks of content or templates that change layout and appearance.


<deviceFilters>
     <filter.../>
</deviceFilters>

The following sections describe attributes, child elements, and parent elements.

Attributes

None.

Child Elements

Element Description

filter

Optional element.

Provides filtering capability for the MobileCapabilities class. There can be one or more filter elements in the <deviceFilters> section.

Parent Elements

Element Description

configuration

The required root element in every configuration file used by the common language runtime and the .NET Framework applications.

system.web

Specifies the root element for the ASP.NET configuration settings in a configuration file. Contains elements that configure ASP.NET Web applications and control how the applications behave.

You can select from two types of device filters: comparison evaluators or evaluator delegates.

For simple comparisons, you can specify a comparison-based filter by providing the name of a capability and a value to compare against. At run time, the device filter evaluates to true if the capability value and the supplied value are equal. Boolean property comparisons are case-insensitive; therefore, true and True are both valid. Other property comparisons are case-sensitive.

For more complex evaluation, you can specify an evaluator delegate-based filter by providing the class and method name of a method. At run time, the supplied method is called to determine whether the device filter evaluates to true.

The following default <deviceFilters> element is not explicitly configured in the machine configuration file or in the root Web.config file, but is the default configuration returned by application in the .NET Framework version 2.0.

<deviceFilters>
    <filter name="isJPhone" compare="Type" argument="J-Phone"/>
    <filter name="isHTML32" compare="PreferredRenderingType" argument="html32"/>
    <filter name="isWML11" compare="PreferredRenderingType" argument="wml11"/>
    <filter name="isCHTML10" compare="PreferredRenderingType" argument="chtml10"/>
    <filter name="isGoAmerica" compare="Browser" argument="Go.Web"/>
    <filter name="isMME" compare="Browser" argument="Microsoft Mobile Explorer"/>
    <filter name="isMyPalm" compare="Browser" argument="MyPalm"/>
    <filter name="isPocketIE" compare="Browser" argument="Pocket IE"/>
    <filter name="isUP3x" compare="Type" argument="Phone.com 3.x Browser"/>
    <filter name="isUP4x" compare="Type" argument="Phone.com 4.x Browser"/>
    <filter name="isEricssonR380" compare="Type" argument="Ericsson R380"/>
    <filter name="isNokia7110" compare="Type" argument="Nokia 7110"/>
    <filter name="prefersGIF" compare="PreferredImageMIME" argument="image/gif"/>
    <filter name="prefersWBMP" compare="PreferredImageMIME" argument="image/vnd.wap.wbmp"/>
    <filter name="supportsColor" compare="IsColor" argument="true"/>
    <filter name="supportsCookies" compare="Cookies" argument="true"/>
    <filter name="supportsJavaScript" compare="Javascript" argument="true"/>
    <filter name="supportsVoiceCalls" compare="CanInitiateVoiceCall" argument="true"/>
</deviceFilters>

The following example configures both a comparison filter and an evaluator delegate filter.

<deviceFilters>
  <filter name="IsHtml" 
    compare="PreferredRendering" 
    argument="html32" />
  <filter name="IsGPSEnabled" 
    type="MyApplication.MyCapabilityEvaluators,MyApplication" 
    method="IsGPSEnabled" />
</deviceFilters>

Configuration Section Handler

System.Web.Mobile.DeviceFiltersSection

Configuration Member

System.Web.Configuration.SystemWebSectionGroup.DeviceFilters

Configurable Locations

Machine.config

Root level Web.config

Application-level Web.config

Web.config

Requirements

IIS 5.0, IIS 5.1, or IIS 6.0

.NET Framework 1.1, or 2.0

Visual Studio 2003, or Visual Studio 2005

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.