<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.iis.net/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/" xmlns:cs="http://blogs.iis.net/"><channel><title>IIS 7 - Troubleshooting</title><link>http://forums.iis.net/1052.aspx</link><description>Questions relating to the new diagnostics engine in IIS 7 such as Failed Request Tracing</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Http headers when using Output Caching</title><link>http://forums.iis.net/thread/1910555.aspx</link><pubDate>Thu, 16 Jul 2009 16:43:58 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1910555</guid><dc:creator>anilr</dc:creator><slash:comments>0</slash:comments><comments>http://forums.iis.net/thread/1910555.aspx</comments><wfw:commentRss>http://forums.iis.net/commentrss.aspx?SectionID=1052&amp;PostID=1910555</wfw:commentRss><description>&lt;p&gt;The headers for the HttpCachePolicy are added by asp.net after the caching module runs and so are not part of the response that is cached.&amp;nbsp; If you want the headers to be cached, just use HttpResponse.SetHeader/AddHeader etc in your code.&lt;/p&gt;</description></item><item><title>Re: Http headers when using Output Caching</title><link>http://forums.iis.net/thread/1910511.aspx</link><pubDate>Thu, 16 Jul 2009 09:24:13 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1910511</guid><dc:creator>ThierryV</dc:creator><slash:comments>0</slash:comments><comments>http://forums.iis.net/thread/1910511.aspx</comments><wfw:commentRss>http://forums.iis.net/commentrss.aspx?SectionID=1052&amp;PostID=1910511</wfw:commentRss><description>&lt;p&gt;Hi Anil,&lt;/p&gt;
&lt;p&gt;This is what I do in the application code.&lt;/p&gt;
&lt;p&gt;A typical request is &lt;a href="http://mysite/get-image.img?path=test.png&amp;amp;width=240&amp;amp;height=320&amp;amp;format=jpg&amp;amp;tag=xyz&amp;amp;expire=365"&gt;http://mysite/get-image.img?path=test.png&amp;amp;width=240&amp;amp;height=320&amp;amp;format=jpg&amp;amp;tag=xyz&amp;amp;expire=365&lt;/a&gt;&lt;br /&gt;Within “get-image.img” code, I have this:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;HttpCachePolicy cachePolicy = HttpContext.Current.Response.Cache;&lt;br /&gt;&amp;nbsp;cachePolicy.SetCacheability(HttpCacheability.Public);&lt;br /&gt;&amp;nbsp;cachePolicy.SetExpires(DateTime.Now.AddDays(expireDays));&lt;br /&gt;&amp;nbsp;cachePolicy.SetValidUntilExpires(true);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I checked the server response (prior to caching), and I do see the “expire” header being sent:&lt;br /&gt;&amp;nbsp;&lt;em&gt;Expires: Fri, 16 Jul 2010 09:00:06 GMT&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;From the IIS manager / Output Caching, I added a custom extension “.img” (to match my get-image.img HttpHandler), with the following configuration:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;User-Mode caching : At time intervals (6 hours)&lt;/div&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;Cache different versions of file base on : query string variable : “*” (I tried enumerating all the parameters, but It wasn’t working well with 8 variables)&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;li&gt;
&lt;div&gt;Kernel-Mode caching : At time intervals (6 hours)&lt;br /&gt;Not sure why the kernel mode doesn’t require to set query string variable, but I tried this with User-Mode alone, or Kernel-Mode alone, and it didn’t fix my problem (another question, by the way, how can both modes be activated at the same time? Does one take precedence over the other?).&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;So after a few request of the same URL, the response content gets cached, but when looking at the response, it’s missing the “expire” header. What should I do so that the header is also sent by the output caching?&lt;/p&gt;
&lt;p&gt;Best,&lt;/p&gt;
&lt;p&gt;Thierry&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Http headers when using Output Caching</title><link>http://forums.iis.net/thread/1910460.aspx</link><pubDate>Wed, 15 Jul 2009 23:03:39 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1910460</guid><dc:creator>anilr</dc:creator><slash:comments>0</slash:comments><comments>http://forums.iis.net/thread/1910460.aspx</comments><wfw:commentRss>http://forums.iis.net/commentrss.aspx?SectionID=1052&amp;PostID=1910460</wfw:commentRss><description>&lt;p&gt;What is the exact output caching rule you have configured?&amp;nbsp; Also, exactly how are you adding the Expires header to the response?&lt;/p&gt;</description></item><item><title>Http headers when using Output Caching</title><link>http://forums.iis.net/thread/1909856.aspx</link><pubDate>Fri, 10 Jul 2009 10:09:49 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1909856</guid><dc:creator>ThierryV</dc:creator><slash:comments>0</slash:comments><comments>http://forums.iis.net/thread/1909856.aspx</comments><wfw:commentRss>http://forums.iis.net/commentrss.aspx?SectionID=1052&amp;PostID=1909856</wfw:commentRss><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I am using the output caching feature from IIS 7 for a website serving mostly runtime-processed images. The output caching works really well; however, it does not remember the HTTP headers of the initial response, particularly the “Expires” one.&lt;/p&gt;
&lt;p&gt;Therefore, any client requesting an image served by the output cache doesn’t receive the HTTP expiration date, and will keep asking for that same image instead of caching it on the client side, thus degrading both the user experience and server performance. Is there a way I can force the output caching to cache the HTTP headers in addition to the actual response content?&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;&lt;br /&gt;Thierry&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>