如何使用C#清除IE的缓存和Cookie [英] how to clear Cache and Cookies for IE using C#
本文介绍了如何使用C#清除IE的缓存和Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尊敬的先生,
我正在使用C#,并且需要在单击特殊按钮后单击
Dear sirs,
i am using C# and i need to Delete all Cache and Cookies after a special button Clicked
推荐答案
删除所有 Cache和Cookies 此处: http://support.microsoft.com/kb/326201 [
See here: http://support.microsoft.com/kb/326201[^]
This clears the cache and the cookies.
^ ]可能实际上会为您提供帮助.
This[^] might actually help you out.
// Clear cache
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
Response.Cache.SetNoStore();
//Clear cookies
string[] cookies = Request.Cookies.AllKeys;
foreach (string cookie in cookies)
{
Response.Cookies[cookie].Expires = DateTime.Now.AddDays(-1);
}
这篇关于如何使用C#清除IE的缓存和Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文