首 页 ASP ASP.NET PHP JSP Ajax DIV+CSS JavaScript XML C#
MySQL MSSQL Access Oracle Linux Server 电脑技巧 网络安全 建站经验 其它

如何设置ASP.NET页缓存的过期时间值

整理日期:2009年04月17日 【字体:


伊图教程网[www.etoow.com]
http://www.etoow.com/html/2009-04/1240011443.html

  注意

  如果以编程方式设置页的到期时间,则您还必须为缓存的页设置 Cache-Control 标头。为此,请调用 SetCacheability 方法并向其传递 HttpCacheability 枚举值 Public。

  下面的代码示例设置与前面过程中的 @ OutputCache 指令相同的缓存策略。

  C#

  复制代码

  Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
  Response.Cache.SetCacheability(HttpCacheability.Public);
  Response.Cache.SetValidUntilExpires(true);

  Visual Basic

  复制代码

  Response.Cache.SetExpires(DateTime.Now.AddSeconds(60))
  Response.Cache.SetCacheability(HttpCacheability.Public)
  Response.Cache.SetValidUntilExpires(True)

  当缓存页到期时,以后对该页的请求将导致动态生成的响应。会在指定的持续时间内缓存该响应页。 
Tags:ASP.NET   页缓存   过期
如何设置ASP.NET页缓存的过期时间值
'http://www.etoow.com/html/2009-04/1240011443.html
1
 
信息搜索
  
联系我们关于本站广告服务设为首页 收藏本站友情链接网站地图
Copyright © Etoow.com Inc. All Rights Reserved