Я использую следующий код для записи заголовка кэша на * .png запросах:
response.Buffer = false;
response.BufferOutput = false;
// 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);
Но каждый раз, когда я обновляю страницу, содержащую URL-адрес PNG, она снова публикуется на веб-сервере. Похоже, что заголовок кеша не работает, и, что еще хуже, кеш браузера тоже не работает.
Я использую asp.net mvc.
Может кто-нибудь указать мне правильное направление? Спасибо!