HttpCachePolicy.SetValidUntilExpires メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim instance As HttpCachePolicy Dim validUntilExpires As Boolean instance.SetValidUntilExpires(validUntilExpires)

SetValidUntilExpires メソッドは、高レベルの <%@ OutputCache … %> ページ ディレクティブが使用された場合は、自動的に true に設定されます。
このメソッドが用意されている理由は、ページ ビューの更新時に HTTP キャッシュ無効化ヘッダーを Web サーバーに送信し、ページをキャッシュから消去するブラウザがあるためです。validUntilExpires パラメータが true の場合、ASP.NET はキャッシュ無効化ヘッダーを無視し、ページは有効期限が切れるまでキャッシュ内に残ります。

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

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHttpCachePolicy.SetValidUntilExpires メソッドを検索する場合は、下記のリンクをクリックしてください。

- HttpCachePolicy.SetValidUntilExpires メソッドのページへのリンク