从浏览器中删除所有cookie/缓存 [英] delete all cookie/cache from browsers
问题描述
问候
sasi
您不能从所有站点中删除用户的所有cookie,只能删除站点中的cookie.此外,cookie和缓存是非常不同的东西.要停止缓存网站,请使用C#,它是:
Response.ExpiresAbsolute = DateTime.Now.Subtract(新 TimeSpan( 1 , 0 , 0 , 0 )) ; Response.Expires = 0 ; Response.CacheControl = " ;
在页面的On_Load方法中.将其转换为VB并不难.关于cookie,该网站似乎在底部有一个很好的例子和良好的链接,包括删除cookie:
http://www.java2s.com/Code/ASP/Session-Cookie/WriteCookieandreadCookieVBnet.htm [ ^ ]
您可能想要使用C#,但是将其转换为C#看起来非常简单.
下一次注意,请尝试搜索自己. Google和CP通常会很容易为此类问题提供答案,我知道我们之前也有类似的问题,因此您可能会发现.
无论如何,希望这会有所帮助,
Ed:)
如果您试图从用户运行的Windows Forms应用程序中进行操作,则必须为要支持的每种浏览器编写一个单独的模块.没有两个浏览器以相同的方式清除其缓存/cookie,并且每个浏览器都没有公开一个API来执行此操作.
您可以在IE购买Google搜索中搜索"VB.NET清除IE cookie缓存".
hi
i need to delete all cookie and cache in browsers using vb.net.. i tried some way but it cant help me.. anyone can help me for this problem..
regards
sasi
You cannot delete all the cookies of a user, from all sites, only cookies from your site. Furthermore, cookies and cache are very different things. To stop caching of your website, in C#, it would be:
Response.ExpiresAbsolute = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0)); Response.Expires = 0; Response.CacheControl = "no-cache";
In the On_Load method of your page. It shouldn''t be too hard to convert that to VB. With regards to cookies, this site seems to have a good example and good links at the bottom, including deleting a cookie:
http://www.java2s.com/Code/ASP/Session-Cookie/WriteCookieandreadCookieVBnet.htm[^]
One you may want is in C# but it looks very simple to convert to C#.
Note for next time, try searching for yourself. Google and CP will normally give the answers very easily for this sort of question, I know we''ve had one similar to this before so you could have found that.
Anyway, hope this helps,
Ed :)
If you''re trying to do with from a Windows Forms app the user runs, you''ll have to write a seperate module for every browser you want to support. No two browsers clear their caches/cookies the same way and there is no single API that every browser exposes to do it.
You can look at IE buy Googling for "VB.NET clear IE cookies cache".
这篇关于从浏览器中删除所有cookie/缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!