deviceFilters 要素 (ASP.NET 設定スキーマ)

ユーザー エージェントまたはブラウザーに基づいて ASP.NET MobileCapabilities システムのデバイスまたはデバイス クラスを指定します。 デバイス フィルターは、ページまたはアプリケーションの開発者がコントロールのプロパティをオーバーライドする場合や、コンテンツまたはテンプレートのブロックを定義してレイアウトと外観を変更する場合に使用できます。

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

属性および要素

以降のセクションでは、属性、子要素、および親要素について説明します。

属性

なし。

子要素

要素

説明

filter

省略可能な要素です。

MobileCapabilities クラスのフィルター処理機能を提供します。 <deviceFilters> セクションには、1 つ以上のフィルター要素を含めることができます。

親要素

要素

説明

configuration

共通言語ランタイムおよび .NET Framework アプリケーションで使用されるすべての構成ファイルで必要なルート要素です。

system.web

構成ファイル内に含まれる ASP.NET の構成設定のルート要素を指定します。 ASP.NET Web アプリケーションを設定し、アプリケーションの動作方法を制御する要素を格納します。

解説

デバイス フィルターは、比較エバリュエーターとエバリュエーター デリゲートの 2 種類から選択できます。

単純比較の場合は、機能の名前と比較対象の値を提供することによって、比較型フィルターを指定できます。 実行時に、このデバイス フィルターは、機能の値と指定された値が等しい場合に true と評価します。 ブール型のプロパティは大文字と小文字を区別しないで比較されるため、true と True は共に有効です。 その他のプロパティの比較では、大文字と小文字が区別されます。

複雑な評価を行う場合は、メソッドのクラスとメソッド名を指定することによって、エバリュエーター デリゲート型フィルターを指定できます。 実行時には、指定されたメソッドが呼び出され、このデバイス フィルターで true と評価されるかどうかを判断します。

既定の構成

次の既定の <deviceFilters> 要素は、マシン構成ファイルやルートの Web.config ファイルでは明示的に構成されていませんが、.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>

使用例

比較型フィルターとエバリュエーター デリゲート型フィルターの両方を構成する例を次に示します。

<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

SystemWebSectionGroup.DeviceFilters

Configurable Locations

Machine.config

ルート レベルの Web.config

アプリケーション レベルの Web.config

Web.config

Requirements

IIS 5.0、IIS 5.1、または IIS 6.0

.NET Framework 1.1 または 2.0

Visual Studio 2003 または Visual Studio 2005

参照

処理手順

方法 : Location の設定を使用して特定のディレクトリを構成する

方法 : ASP.NET 構成設定をロックする

参照

system.web 要素 (ASP.NET 設定スキーマ)

configuration 要素 (全般設定スキーマ)

deviceFilters の filter 要素 (ASP.NET 設定スキーマ)

mobileControls 要素 (ASP.NET 設定スキーマ)

MobileCapabilities

System.Configuration

System.Web.Configuration

概念

ASP.NET 構成ファイルの階層と継承

ASP.NET 構成の保護

ASP.NET の構成のシナリオ

その他の技術情報

Using Device Filters

ASP.NET Mobile Web Pages

ASP.NET モバイル Web ページの作成

全般構成設定 (ASP.NET)

ASP.NET 構成設定

ASP.NET Web サイト管理

ASP.NET 構成ファイル

ASP.NET 構成 API