我使用以下代碼在* .png請求上寫入緩存頭: response.Buffer = false; response.BufferOutput = false;asp.net MVC的緩存和Firefox的緩存如何工作?
// Emit content type and encoding based on the file extension and
// whether the response is compressed
response.ContentType = MimeMapping.GetMimeMapping(physicalFilePath);
if (mode != ResponseCompressionType.None)
response.AppendHeader("Content-Encoding", mode.ToString().ToLower());
response.AppendHeader("Content-Length", count.ToString());
// Emit proper cache headers that will cache the response in browser's
// cache for the default cache duration
response.Cache.SetCacheability(HttpCacheability.Public);
response.Cache.AppendCacheExtension("must-revalidate, proxy-revalidate");
response.Cache.SetMaxAge(DEFAULT_CACHE_DURATION);
response.Cache.SetExpires(DateTime.Now.Add(DEFAULT_CACHE_DURATION));
response.Cache.SetLastModified(lastModified);
但每次刷新包含PNG URL的頁面時,它都會重新發布到Web服務器。看起來緩存頭不起作用,更糟糕的是,它使瀏覽器緩存不能工作。
我使用的是asp.net mvc。 有人能指出我正確的方向嗎?謝謝 !