Udostępnij za pośrednictwem


<filter> Element

Provides filtering capability for the MobileCapabilities class from within the <deviceFilters> section of the Web.config file. You specify a <filter> element within a <deviceFilters> section of the <system.web> section of the configuration file.

<system.web
  <deviceFilters>
    <filter
      name="capability"
      compare="capabilityName" />
    <filter
      name="capability"
      type="className"
      method="methodName" />
  </deviceFilters>
</system.web>

Remarks

When creating a Web application that has device-specific content, you must add one or more filters in a <deviceFilter> section in the configuration file. Each filter specifies criteria against which target devices should be matched.

The device filter configuration provides an evaluation mechanism for two types of filters: a comparison-based filter and an evaluator delegate–based filter. The syntax specifies both types of filters. The first example shows the comparison-based filter, and the second example shows the evaluator delegate-based filter. For more information about creating filters in the configuration file, see Device-Specific Rendering.

Example

This example shows comparison-based and evaluator delegate-based filters.

<system.web
  <deviceFilters>
    <filter
      name="isWML11"
      compare="PreferredRenderingType"
      argument="wml11" />
    <filter name="GPSEnabled" 
      type="MyNamespace.MyCapabilityEvaluators, MyAssembly"
      method="IsGPSEnabled"/>
  </deviceFilters>
</system.web>

See Also

Concepts

<DeviceSpecific> Element

Device Evaluation Methods

Reference

<Choice> Element (.NET Framework Developer's Guide )