我试图设置cachability的ASP.NET资源。所以如果我goto/foo/show它会显示一些资源的视图,并缓存几个小时(例如)。为此,我使用OutputCache属性来装饰我的Action方法。该缓存的详细信息(针对此操作方法)可在web.config文件中找到。如何在ASP.NET应用程序中设置S-MaxAge CacheControl值?
当我设置此输出缓存时,它正确设置maxage value
..但s-maxage
值为0. WTF?
这里的代码...
[Authorize]
[OutputCache(CacheProfile = "SomeController_Show")]
public ActionResult Show(){ ... }
,这里是配置文件的一个片断..
<add name="SomeController_Show" duration="3600" varyByParam="authkey;format;blah" />
和响应的一个片段:
Cache-Control:public, max-age=3576, **s-maxage=0**
Content-Length:746
Content-Type:application/json; charset=utf-8
Date:Tue, 10 Aug 2010 00:42:17 GMT
Expires:Tue, 10 Aug 2010 01:41:53 GMT
Last-Modified:Tue, 10 Aug 2010 00:41:53 GMT
Server:Microsoft-IIS/7.0
Vary:*
注意maxage是如何正确设置的,但s-maxage不是?有人可以帮我解决这个问题吗?