你现在的代码就可以了,如果p.aspx?bh=1缓存快照实效的话,自己就更新了,而p.aspx?bh=2的不会受影响

解决方案 »

  1.   

    是这样的:p.aspx?bh=1
    p.aspx?bh=2
    都能缓存啊。
    但是有时候我想删除p.aspx?bh=1的缓存,重新生成,而不影响原来p.aspx?bh=2的缓存
      

  2.   

    没有“bh=1的缓存”、“bh=2的缓存”。缓存就是“一个”独立的对象,不是你所说的那么不合逻辑的缓存概念。
      

  3.   

    response好像有个什么remove方法 好像是隐藏方法
      

  4.   

    去除<%@OutputCache Duration="120000" VaryByParam="bh" %>
    后台page_load中
      if (Request.QueryString["bh"].ToString() == "2")
            {
                HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddMilliseconds(120000));
                HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Public);
            }
      

  5.   

    sorry i forgot one thing
    if (Request.QueryString["bh"].ToString() == "2")
            {
     HttpContext.Current.Response.Cache.VaryByParams.IgnoreParams = true;
                HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddMilliseconds(120000));
                HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Public);
            }