Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 为什么每次重建vs project都必须清除浏览器历史记录_Visual Studio - Fatal编程技术网

Visual studio 为什么每次重建vs project都必须清除浏览器历史记录

Visual studio 为什么每次重建vs project都必须清除浏览器历史记录,visual-studio,Visual Studio,浏览器是Chrome浏览器。我正在使用Visual studio 2015和ASP.NET Web应用程序项目。 不知何故,每当我重建项目时,我必须首先清除chrome缓存。否则,它只加载我的项目的早期版本。(不显示我的更改。)我应该如何解决此问题?谢谢。在您的页面加载事件中使用此代码,以避免浏览器缓存您的详细信息。 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) {

浏览器是Chrome浏览器。我正在使用Visual studio 2015和ASP.NET Web应用程序项目。
不知何故,每当我重建项目时,我必须首先清除chrome缓存。否则,它只加载我的项目的早期版本。(不显示我的更改。)我应该如何解决此问题?谢谢。

在您的页面加载事件中使用此代码,以避免浏览器缓存您的详细信息。
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {                            
        Response.ClearHeaders();
        Response.AddHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
        Response.AddHeader("Pragma", "no-cache");
    }
}
无论您的项目生成多少次,浏览器都无法在Web表单上缓存您的详细信息

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {                            
        Response.ClearHeaders();
        Response.AddHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
        Response.AddHeader("Pragma", "no-cache");
    }
}

如果您特别想删除某些项目,请使用以下方法:

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {                            
        Response.ClearHeaders();
        Response.AddHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
        Response.AddHeader("Pragma", "no-cache");
    }
}
Cache.Remove("MyItem");   //Removing the item with the key named 'MyItem'.

FYI:存储在浏览器中的整个缓存列表(例如Chrome)可以通过以下方式查看:

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {                            
        Response.ClearHeaders();
        Response.AddHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
        Response.AddHeader("Pragma", "no-cache");
    }
}
  • 在浏览器中打开新选项卡
  • URL中键入about:cache
您将能够在浏览器的缓存中看到项目列表

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {                            
        Response.ClearHeaders();
        Response.AddHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
        Response.AddHeader("Pragma", "no-cache");
    }
}