HttpCachePolicy.SetValidUntilExpires メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HttpCachePolicy.SetValidUntilExpires メソッドの意味・解説 

HttpCachePolicy.SetValidUntilExpires メソッド

クライアントから送信された、キャッシュ無効にする HTTP Cache-Control ヘッダーASP.NET キャッシュ無視するかどうか指定します

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

Public Sub SetValidUntilExpires ( _
    validUntilExpires As Boolean _
)
Dim instance As HttpCachePolicy
Dim validUntilExpires As Boolean

instance.SetValidUntilExpires(validUntilExpires)
public void SetValidUntilExpires (
    bool validUntilExpires
)
public:
void SetValidUntilExpires (
    bool validUntilExpires
)
public void SetValidUntilExpires (
    boolean validUntilExpires
)
public function SetValidUntilExpires (
    validUntilExpires : boolean
)

パラメータ

validUntilExpires

キャッシュCache-Control 無効化ヘッダー無視する場合trueそれ以外場合false

解説解説
使用例使用例

SetValidUntilExpires メソッド使用してクライアントによって送信されキャッシュ無効化ヘッダー無視するよう指示する方法次のコード例示します

<html>
<head>
<script language="VB" runat="server">

' The following example demonstrates the SetValidUntilExpires method
 of the
' HttpCachePolicy class. The SetValidUntilExpires method is set to true
 so that
' the ASP.NET cache ignores the HTTP Cache-Control headers and the page
 remains 
' in the cache until it expires.

Sub Page_Load(Sender As Object,
 e As EventArgs)
   ' Set the expiration time for the page.
   Response.Cache.SetExpires(DateTime.Now.AddSeconds(60))
   ' Set the VaryByHeaders attribute with the value Accept-Language
 to true.
   Response.Cache.VaryByHeaders("Accept-Language")
 = True
   ' ASP.NET ignores cache invalidation headers and the page remains
 in
   ' the cache until it expires.
   Response.Cache.SetValidUntilExpires(True)
   Response.Write("The SetValidUntilExpires method is set to true
 and the ASP.NET cache will " _
      & " ignore the Cache-Control headers sent by the client
 that invalidate the cache.")
End Sub 'Page_Load

</script>
</head>
<body></body>
</html>
<html>
<head>
<script language="C#" runat="server">

// The following example demonstrates the SetValidUntilExpires method
 of the
// HttpCachePolicy class. The SetValidUntilExpires method is set to
 true so 
// that the ASP.NET cache ignores the HTTP Cache-Control headers and
 the page 
// remains in the cache until it expires.

void Page_Load(object Sender, EventArgs e)
{
   // Set the expiration time for the page.
   Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
   // Set the VaryByHeaders attribute with the value Accept-Language
 to true.
   Response.Cache.VaryByHeaders["Accept-Language"] = true;
   // ASP.NET ignores cache invalidation headers and the page remains
 in 
   // the cache until it expires.
   Response.Cache.SetValidUntilExpires(true);
   Response.Write("The SetValidUntilExpires method is set
 to true and ASP.NET cache should " + 
      "ignore the Cache-Control headers sent by the client that invalidate the
 cache.");
}

</script>
</head>
<body></body>
</html>
// The following example demonstrates the SetValidUntilExpires method
 of the
// HttpCachePolicy class. The SetValidUntilExpires method is set to
 true so 
// that the ASP.NET cache ignores the HTTP Cache-Control headers and
 the page 
// remains in the cache until it expires.
void Page_Load(Object sender, EventArgs e) 
{
    // Set the expiration time for the page.
    get_Response().get_Cache().SetExpires(DateTime.get_Now().AddSeconds(60));
    
    // Set the VaryByHeaders attribute with the value Accept-Language
 to true.
    get_Response().get_Cache().get_VaryByHeaders().set_Item(
        "Accept-Language" , true );
    
    // ASP.NET ignores cache invalidation headers and the page remains
 in 
    // the cache until it expires.
    get_Response().get_Cache().SetValidUntilExpires(true);
    get_Response().Write("The SetValidUntilExpires method is set
 to true"
        +" and ASP.NET cache should ignore the Cache-Control headers sent"
        +" by the client that invalidate the cache.");
} //Page_Load
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からHttpCachePolicy.SetValidUntilExpires メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からHttpCachePolicy.SetValidUntilExpires メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からHttpCachePolicy.SetValidUntilExpires メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

HttpCachePolicy.SetValidUntilExpires メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HttpCachePolicy.SetValidUntilExpires メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS