Sunday, July 22, 2007

Cache: Response.Cache Code Listing

Code Listing: Response.Cache

private void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetExpires(System.DateTime.Now.AddSeconds(5));
Response.Cache.VaryByParams[“None”] = true;
Response.Cache.SetCacheability(HttpCacheability.Public);
}

This is same as:
<%@ OutputCache Duration=”5” VaryByParams=”None” Location=”Any” %>

No comments: