Friday, July 7, 2017

Cache

khi xử lý file ashx , đặc biệt là khi mục đích là tạo ra ảnh phía server, nên thêm đoạn sau vào hàm ProcessRequest để cho phép client cache lại ảnh:
 context.Response.Cache.SetCacheability(HttpCacheability.Public);
            context.Response.Cache.SetExpires(DateTime.Now.AddMinutes(120));
            context.Response.Cache.SetMaxAge(new TimeSpan(0, 120, 0));

Trên IIS, config cache trong mục OutPut Caching

No comments:

Post a Comment