2011-06-24 43 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。