Share via


DeviceFilter Class [IIS 7 and higher]

Specifies criteria for determining mobile browser capabilities or the type of mobile device.

Syntax

class DeviceFilter : CollectionElement

Methods

This class contains no methods.

Properties

The following table lists the properties exposed by the DeviceFilter class.

Name

Description

Argument

A read/write string value that specifies a keyword to be compared. The Compare property specifies the category for the keyword.

Compare

A read/write string value that specifies the category for a keyword to be compared. The Argument property specifies the keyword to be compared.

Method

A read/write string value that contains the name of a method to be used in an evaluator-delegate filter. The method determines whether the device filter evaluates to true. If you specify a value for this property, you must also specify a value for the Type property.

Name

A required unique read/write string value that specifies the name of the device filter. The key property.

Type

A read/write string value that specifies the class of an evaluator delegate method. If you specify a value for this property, you must also specify a value for the Method property.

Subclasses

This class contains no subclasses.

Remarks

Instances of this class are contained in the DeviceFilters property of the DeviceFiltersSection class.

The properties in this class specify criteria against which target mobile devices and capabilities should be matched. You can select from two types of device filters: comparison evaluators or evaluator delegates.

For the comparison-based filter, you use the Compare and Argument properties to specify a capability and the value that you want the filter to compare. At run time, the evaluator succeeds if the value that you provide and the value that is returned are equal. Compared Boolean properties are case-insensitive (for example, "true" and "True" are considered to be equal). Other compared properties are case-sensitive.

You can implement more complex evaluations by specifying an evaluator-delegate-based filter. This type of filter delegates the evaluation to a method that you create. To implement an evaluator-delegate method, specify the method name in the Method property and the method's class in the Type property. At run time, the method that you specified is called to perform the evaluation.

The following DeviceFilters element is not explicitly configured in the machine configuration file or in the root Web.config file, but it is the default configuration returned in the .NET Framework 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>

Inheritance Hierarchy

CollectionElement

   DeviceFilter

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

CollectionElement Class [IIS 7 and higher]

DeviceFiltersSection Class [IIS 7 and higher]

SystemWebSectionGroupDeviceFilters()()()()

Other Resources

<filter> Element

Device-Specific Rendering

System.Web.Mobile.MobileCapabilities Class