2011-06-24 39 views
0

我想缓存输出JavaScript的Web处理程序,问题是在我的Web解决方案中服务器不缓存,但它确实在原型项目中缓存。是否有像安全或其他任何可能会强制执行可执行代码的调用而不将服务器缓存提供回客户端的东西?HttpCacheability.Server-Web处理程序

这是我在用的,就像我说这工作正常的原型解决方案,所以必须是环境:

 TimeSpan freshness = new TimeSpan(24, 0, 00); 
     DateTime now = DateTime.Now; 

     currentContext.Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); 
     currentContext.Response.Cache.SetCacheability(HttpCacheability.Server); 
     currentContext.Response.Cache.SetValidUntilExpires(true); 


     currentContext.Response.ContentType = JAVASCRIPT_CONTENT_TYPE; 
     currentContext.Response.Write(DateTime.Now.Ticks.ToString()); 

回答

0

固定我自己的问题。在代码中,我使用Response.OutputStream而不是Response.Write。