本文整理汇总了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);
}