使用过期删除Cookie在某些计算机上不起作用 [英] Delete Cookies using expires doesn't work on some computers

查看:70
本文介绍了使用过期删除Cookie在某些计算机上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道过去曾多次讨论过这个话题,但我仍然没有找到任何答案。

I know that this topic has been discussed several times in the past, but still I haven't found any answer for my particular case.

我试图使用InternetSetCookie删除永久性cookie,过期属性设置为过去的某个日期。

I am trying to delete permanent cookies using InternetSetCookie with expires property set to some date in the past.

此代码在某些机器上运行正常,但不能

This code works fine on some machines, but doesn't work on others.

具体来说,这与使用RememberMe功能设置的cookie有关,如果它有任何区别。

Specifically this relates to the cookies which were set using RememberMe functionality if it makes any difference.

这是代码:

URI uri(i_URL);

URI uri (i_URL);

字符串主机;

string port;

string port;

uri.getHostAndPort(host,port);

uri.getHostAndPort (host, port);

string cookieString =

string cookieString =

" =; expires = Thu,18-Apr-2000 00:00:00 GMT" ;

"=; expires = Thu, 18-Apr-2000 00:00:00 GMT";

InternetSetCookie(i_URL.c_str(),NULL,(cookieName + cookieString).c_str());

InternetSetCookie( i_URL.c_str(), NULL, (cookieName + cookieString).c_str());

 

 

< span style ="color:#0000ff; font-size:x-small"> bool isIP = SockAddress :: isIPAddress(host) ;

bool isIP = SockAddress::isIPAddress(host);

 

if (!isIP)

if (!isIP)

{

 

int index = host.find( '。' );

int index = host.find('.');

 

while (index> = 0)

while (index >= 0)

{

string fullCookieString = cookieString +

string fullCookieString = cookieString +

" ;; domain =" + host.substr(index);

"; domain=" + host.substr(index);

index = host.find(

index = host.find(

'。' ,index + 1);

'.', index+1 );

 

if (index> = 0){

InternetSetCookie(i_URL.c_str(),NULL,(cookieName + fullCookieString).c_str());

InternetSetCookie( i_URL.c_str(), NULL, (cookieName + fullCookieString).c_str());

}

}

}

else

{

string fullCookieString = cookieString +

string fullCookieString = cookieString +

< span style ="color:#a31515; font-size:x-small"> " ;; domain =" + host;

"; domain=" + host;

InternetSetCookie(i_URL.c_str(),NULL,(cookieName + fullCookieString).c_str());

InternetSetCookie( i_URL.c_str(), NULL, (cookieName + fullCookieString).c_str());

}

我两个都有IE8它工作的机器和不工作的机器。

I have IE8 on both machines where it works and where it doesn't work.

我还认为它与某些可能涉及的注册表项有关,导致浏览器以不同的方式工作,但是避难所找到了一个。

I also think that it is somehow relates to some Registry key that might be involved that causes the browser to work differently, but haven't found one.

很高兴听到有关为什么会发生这种情况的任何意见。

Will be grateful to hear any opinion for as to why this might happen.

提前致谢,

Evgeny

 

推荐答案

你好Evgeny,

Hi Evgeny,

感谢您的提问。

我试图让熟悉这个主题的人参与进一步研究这个问题。可能会有一些时间延迟。感激你的耐心。

感谢您的理解和支持。

 


这篇关于使用过期删除Cookie在某些计算机上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆