0
我有IHttp通用處理程序(.ashx)的圖像,我已經發送緩存過期時間爲7天,但在谷歌網頁洞察它說我應該添加緩存驗證程序。 以下是我的代碼。請給我介紹一些東西。圖像緩存驗證器的IHttp通用處理程序(.ashx)
public void ProcessRequest(HttpContext context)
{
TimeSpan refresh = TimeSpan.FromDays(7);
context.Response.Cache.SetExpires(DateTime.Now.Add(refresh));
context.Response.Cache.SetMaxAge(refresh);
context.Response.Cache.SetCacheability(HttpCacheability.Public);
context.Response.CacheControl = HttpCacheability.Public.ToString();
context.Response.Cache.SetValidUntilExpires(true);
}
感謝