PdfRpt.Core.Helper.SoftHttpContext.setNoCache C# (CSharp) Method

setNoCache() private static method

private static setNoCache ( object response ) : void
response object
return void
        private static void setNoCache(object response)
        {
            var cacheProperty = response.GetType().GetProperty("Cache");
            var cache = cacheProperty.GetValue(response, null);
            if (cache == null)
                throw new InvalidOperationException(Error);

            var setCacheability = cache.GetType().GetMethods().FirstOrDefault(x => x.Name == "SetCacheability");
            if (setCacheability == null)
                throw new InvalidOperationException(Error);

            setCacheability.Invoke(cache, new object[] { 1 /* HttpCacheability.NoCache */ });
        }