BlogEngine.Core.Web.HttpModules.CompressionModule.SetHeaders C# (CSharp) Method

SetHeaders() private static method

private static SetHeaders ( HttpContext context ) : void
context System.Web.HttpContext
return void
        private static void SetHeaders(HttpContext context)
        {
            var response = context.Response;
            var cache = response.Cache;

            cache.VaryByHeaders["Accept-Encoding"] = true;
            cache.SetExpires(DateTime.UtcNow.AddDays(30));
            cache.SetMaxAge(new TimeSpan(365, 0, 0, 0));
            cache.SetRevalidation(HttpCacheRevalidation.AllCaches);

            var etag = string.Format("\"{0}\"", context.Request.Path.GetHashCode());
            var incomingEtag = context.Request.Headers["If-None-Match"];

            cache.SetETag(etag);
            cache.SetCacheability(HttpCacheability.Public);

            if (String.Compare(incomingEtag, etag) != 0)
            {
                return;
            }

            response.Clear();
            response.StatusCode = (int)HttpStatusCode.NotModified;
            response.SuppressContent = true;
        }