<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Cache-Control header cannot be set properly in ASP.NET 2.0 - A solution</title><link>http://msmvps.com/blogs/omar/archive/2006/08/02/cache-control-header-cannot-be-set-properly-in-asp-net-2-0-a-solution.aspx</link><description>Do you know that you cannot set Cache-Control: max-age header in ASP.NET 2.0? No matter how many combinations you try, you will always end up with &amp;quot;max-age=0&amp;quot; for sure. I found solution to the SetMaxAge problem in HttpCachePolicy. Here&amp;#39;s</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: Cache-Control header cannot be set properly in ASP.NET 2.0 - A solution</title><link>http://msmvps.com/blogs/omar/archive/2006/08/02/cache-control-header-cannot-be-set-properly-in-asp-net-2-0-a-solution.aspx#1448206</link><pubDate>Tue, 08 Jan 2008 19:58:37 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1448206</guid><dc:creator>David Stevenson</dc:creator><description>&lt;p&gt;I am getting a max-age of 9999999 and TWO Cache-Control headers. the max-age of 9,999,999 seconds, or about 115 days, which conflicts with my setting of 365 days in the Expires HTTP header. I am wondering why I am getting TWO Cache-Control headers, and a max-age I didn't specify.&lt;/p&gt;
&lt;p&gt;HTTP/1.1 200 OK&lt;/p&gt;
&lt;p&gt;Server: Microsoft-IIS/5.0&lt;/p&gt;
&lt;p&gt;Date: Tue, 08 Jan 2008 19:49:41 GMT&lt;/p&gt;
&lt;p&gt;X-Powered-By: ASP.NET&lt;/p&gt;
&lt;p&gt;Cache-Control: public, max-age=9999999&lt;/p&gt;
&lt;p&gt;X-AspNet-Version: 2.0.50727&lt;/p&gt;
&lt;p&gt;Cache-Control: public&lt;/p&gt;
&lt;p&gt;Expires: Wed, 07 Jan 2009 19:49:41 GMT&lt;/p&gt;
&lt;p&gt;Last-Modified: Thu, 28 Jul 2005 22:08:28 GMT&lt;/p&gt;
&lt;p&gt;Content-Type: image/gif&lt;/p&gt;
&lt;p&gt;Content-Length: 2306&lt;/p&gt;
&lt;p&gt;resp.Cache.SetExpires(DateTime.Now.AddSeconds(365 * 24 * 60 * 60)); &amp;nbsp; &amp;nbsp;// Expires in one year.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Public - Allows the response to be cached by clients and shared (proxy) caches.&lt;/p&gt;
&lt;p&gt;resp.Cache.SetCacheability(HttpCacheability.Public);&lt;/p&gt;
&lt;p&gt;resp.Cache.SetValidUntilExpires(true);&lt;/p&gt;
&lt;p&gt;FileInfo file = new FileInfo(path);&lt;/p&gt;
&lt;p&gt;resp.Cache.SetLastModified(file.LastWriteTimeUtc);&lt;/p&gt;
&lt;p&gt;David Stevenson&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1448206" width="1" height="1"&gt;</description></item><item><title>re: Cache-Control header cannot be set properly in ASP.NET 2.0 - A solution</title><link>http://msmvps.com/blogs/omar/archive/2006/08/02/cache-control-header-cannot-be-set-properly-in-asp-net-2-0-a-solution.aspx#1205445</link><pubDate>Wed, 19 Sep 2007 06:25:09 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1205445</guid><dc:creator>Milan</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What abount 3.x version of frameworks? Do they have the same issue?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1205445" width="1" height="1"&gt;</description></item></channel></rss>