当前位置: 首页>>代码示例>>C#>>正文


C# HttpContextBase.SetClientCachingResponse方法代码示例

本文整理汇总了C#中System.Web.HttpContextBase.SetClientCachingResponse方法的典型用法代码示例。如果您正苦于以下问题:C# HttpContextBase.SetClientCachingResponse方法的具体用法?C# HttpContextBase.SetClientCachingResponse怎么用?C# HttpContextBase.SetClientCachingResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.HttpContextBase的用法示例。


在下文中一共展示了HttpContextBase.SetClientCachingResponse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetCaching

        /// <summary>
        /// Sets the output cache parameters and also the client side caching parameters
        /// </summary>
        /// <param name="context"></param>
        /// <param name="fileName">The name of the file that has been saved to disk</param>
        /// <param name="fileset">The Base64 encoded string supplied in the query string for the handler</param>
        /// <param name="compressionType"></param>
        /// <param name="page">The outputcache page - ensures server side output cache is stored</param>
        private void SetCaching(HttpContextBase context, string fileName, string fileset, CompressionType compressionType, OutputCachedPage page)
        {
            //this initializes the webforms page part to get outputcaching working server side
            page.ProcessRequest(HttpContext.Current);

            // in any case, cache already varies by pathInfo (build-in) so for path formats, we do not need anything
            // just add params for querystring format, just in case...
            context.SetClientCachingResponse(
                //the e-tag to use
                (fileset + compressionType.ToString()).GenerateHash(), 
                //10 days
                10, 
                //vary-by params
                new[] { "t", "s", "cdv" });

            //make this output cache dependent on the file if there is one.
            if (!string.IsNullOrEmpty(fileName))
                context.Response.AddFileDependency(fileName);
        }
开发者ID:dufkaf,项目名称:ClientDependency,代码行数:27,代码来源:CompositeDependencyHandler.cs


注:本文中的System.Web.HttpContextBase.SetClientCachingResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。