Visual studio 为什么每次重建vs project都必须清除浏览器历史记录
浏览器是Chrome浏览器。我正在使用Visual studio 2015和ASP.NET Web应用程序项目。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缓存。否则,它只加载我的项目的早期版本。(不显示我的更改。)我应该如何解决此问题?谢谢。在您的页面加载事件中使用此代码,以避免浏览器缓存您的详细信息。
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");
}
}