HttpRequestCachePolicy クラス
アセンブリ: System (system.dll 内)


DefaultCachePolicy プロパティ、アプリケーション構成ファイル、またはコンピュータの構成ファイルを使用して、アプリケーションの既定のキャッシュ ポリシーを指定できます。詳細については、「requestCaching 要素 (ネットワーク設定)」を参照してください。

アプリケーション ドメインの既定のキャッシュ ポリシーを作成し、ある要求について、そのポリシーをオーバーライドするコード例を次に示します。
// The following method demonstrates overriding the // caching policy for a request. public static WebResponse GetResponseNoCache(Uri uri) { // Set a default policy level for the "http:" and "https" schemes. HttpRequestCachePolicy policy = new HttpRequestCachePolicy(HttpRequestCacheLevel.Default); HttpWebRequest.DefaultCachePolicy = policy; // Create the request. WebRequest request = WebRequest.Create(uri); // Define a cache policy for this request only. HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore); request.CachePolicy = noCachePolicy; WebResponse response = request.GetResponse(); Console.WriteLine("IsFromCache? {0}", response.IsFromCache); return response; }

System.Net.Cache.RequestCachePolicy
System.Net.Cache.HttpRequestCachePolicy


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


- HttpRequestCachePolicy クラスのページへのリンク