HttpResponse.Cache Propriété

Définition

Obtient la stratégie de mise en cache d’une page web (délai d’expiration, paramètres de confidentialité, clauses diverses).

public:
 property System::Web::HttpCachePolicy ^ Cache { System::Web::HttpCachePolicy ^ get(); };
public System.Web.HttpCachePolicy Cache { get; }
member this.Cache : System.Web.HttpCachePolicy
Public ReadOnly Property Cache As HttpCachePolicy

Valeur de propriété

HttpCachePolicy

Objet HttpCachePolicy qui contient les informations sur la stratégie de mise en cache de la réponse actuelle.

Exemples

L’exemple suivant écrit les propriétés de la stratégie de cache actuelle dans le flux de sortie HTTP.

Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetValidUntilExpires(false);
Response.Cache.VaryByParams["Category"] = true;

if (Response.Cache.VaryByParams["Category"])
{
   //...
}
Response.Cache.SetExpires(DateTime.Now.AddSeconds(60))
Response.Cache.SetCacheability(HttpCacheability.Public)
Response.Cache.SetValidUntilExpires(False)
Response.Cache.VaryByParams("Category") = True

If Response.Cache.VaryByParams("Category") Then
   '...
End If
 

S’applique à