代码之家  ›  专栏  ›  技术社区  ›  DaveDev

ASP.NET Development Server未更新对标记/代码的更改

  •  6
  • DaveDev  · 技术社区  · 14 年前

    如果我在IIS中工作并更改了某些内容,则ctrl+F5将始终使用我所做的更改更新页面。我希望dev服务器同样可靠。有人有什么建议吗?

    2 回复  |  直到 14 年前
        1
  •  1
  •   user240141 user240141    13 年前

    尝试清除缓存。。每一次请求

    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
    

    如果仍然不起作用。在pag load事件中尝试这一组代码

    Response.AppendHeader("Pragma", "no-cache"); 
    Response.AppendHeader("Cache-Control", "no-cache");
    
    Response.CacheControl = "no-cache"; 
    Response.Expires = -1;
    
    response.ExpiresAbsolute = new DateTime(1900, 1, 1); 
    response.Cache.SetCacheability(HttpCacheability.NoCache);