次の方法で共有


HttpCachePolicy.SetVaryByCustom メソッド

キャッシュされている出力応答の変更に使用するカスタム テキスト文字列を指定します。

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)

構文

'宣言
Public Sub SetVaryByCustom ( _
    custom As String _
)
'使用
Dim instance As HttpCachePolicy
Dim custom As String

instance.SetVaryByCustom(custom)
public void SetVaryByCustom (
    string custom
)
public:
void SetVaryByCustom (
    String^ custom
)
public void SetVaryByCustom (
    String custom
)
public function SetVaryByCustom (
    custom : String
)
適用できません。

パラメータ

  • custom
    キャッシュされている出力の変更に使用するテキスト文字列。

例外

例外の種類 条件

ArgumentNullException

custom が null 参照 (Visual Basic では Nothing) です。

InvalidOperationException

SetVaryByCustom メソッドが既に呼び出されています。

使用例

カスタム変更文字列に "Accept-Charset" を設定し、ブラウザの Accept-Charset ヘッダーに応じて、キャッシュされている複数の応答からいずれかを選択するように送信元サーバーのキャッシュに通知する方法を次のコード例に示します。

Response.Cache.SetVaryByCustom("Accept-Charset")
 
Response.Cache.SetVaryByCustom("Accept-Charset");
 
get_Response().get_Cache().SetVaryByCustom("Accept-Charset");
Response.Cache.SetVaryByCustom("Accept-Charset")
 

プラットフォーム

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

バージョン情報

.NET Framework

サポート対象 : 3.0,2.0,1.1,1.0

参照

関連項目

HttpCachePolicy クラス
HttpCachePolicy メンバ
System.Web 名前空間