如何在不重新启动浏览器的情况下清除缓存

时间:2014-03-18 08:50:39

标签: c# browser-cache

我尝试删除缓存而不使用asp.net C#代码重新启动浏览器。 这是我的代码

HttpCookie myCookie = new HttpCookie("email_address");
myCookie.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Add(myCookie);

HttpCookie tenantcookie = new HttpCookie("tenant_id");
tenantcookie.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Add(tenantcookie);

HttpCookie access_token = new HttpCookie("access_token");
access_token.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Add(access_token);

缓存已被删除,但我必须关闭浏览器并再次打开浏览器以显示缓存是否已被删除。

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

出于安全原因,您无法使用代码清除浏览器的历史记录。

您可以删除浏览器缓存目录下的所有文件和文件夹, 这是

的默认缓存位置
  • mozilla - " C:\ Documents and Settings \%username%\ Local Settings \ Application Data \ Mozilla \ Firefox \ Profiles \ xxxxxxx.xxxx"
  • chrome =" \ AppData \ Local \ Google \ Chrome \ User Data \ Default \ Cache。"

它是隐藏的,您可以从文件夹选项更改视图。