共用方式為


<deviceFilters> 

Specifies the configuration section for filtering within the <system.web> section of the Web.config file.

<system.web>
   <deviceFilters>
      <filter name="capability"
         compare="capabilityName"
         argument="argument" />
      <filter name="capability"
         type="className"
         method="methodName" />
      <!-- Additional filters here. -->
   </deviceFilters>
</system.web>

Remarks

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 properties are compared as case insensitive, thus true and True are equivalent. Other properties are compared as 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 <filter> element has the attributes shown in the following table.

Attribute Description

name

Specifies the unique name for the device filter.

NoteNote

A filter with the same name as an earlier defined filter (either later in the configuration file or later in the configuration file hierarchy) will override the filter that was previously defined.

compare

Specifies the capability evaluated by the comparison evaluator. The capability can be any built-in capability or the name of any other custom capability evaluator.

argument

Specifies the argument against which the capability will be compared.

type

Specifies the class type that supplies the evaluator delegate. The name must be fully qualified. ASP.NET will search the specified assembly for the type.

method

Specifies the method that supplies the evaluator delegate. The method must be static and have the following signature:

static bool EvaluatorMethod(System.Web.Mobile.MobileCapabilities capabilities,
   String compareArgument)

See Also

Reference

<filter> Element