我使用以下代码在* .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。 有人能指出我正确的方向吗?谢谢 !