ashx 指定客户端缓存

方式一:(比较简陋的)

                context.Response.Cache.SetCacheability(HttpCacheability.Public); 
                context.Response.Expires = 100; //Minutes

方式二:(比较全的设置)

                TimeSpan refresh = new TimeSpan(0, 15, 0);//时,分,秒
                context.Response.Cache.SetExpires(DateTime.Now.Add(refresh));
                context.Response.Cache.SetMaxAge(refresh);
                context.Response.Cache.SetCacheability(HttpCacheability.Public);
                context.Response.CacheControl = HttpCacheability.Public.ToString();
                context.Response.Cache.SetValidUntilExpires(true);

你可能感兴趣的:(客户端)