【问题标题】:InternetGetCookie does not retrieve all cookiesInternetGetCookie 不检索所有 cookie
【发布时间】:2010-08-24 18:31:51
【问题描述】:

我正在尝试使用 InternetGetCookie 从 IE 中检索 cookie。我遇到的问题是,有时在 cookie 文件中可能有 2 个甚至 3 个不同的 cookie,但 InternetGetCookie 总是检索仅与第一个 cookie 关联的数据。我尝试为同一个 cookie url 连续调用 InternetGetCookie 两次,但它所做的只是两次检索第一个 cookie 数据。谢谢!

【问题讨论】:

    标签: internet-explorer cookies


    【解决方案1】:

    您的代码在哪里(哪个进程)运行?当您说“相同的 cookie url”时,您是什么意思?

    一些注意事项:

    • 默认情况下,InternetGetCookie 不会返回 HTTPOnly cookie
    • InternetGetCookie 将只返回来自当前 进程的持久 cookie 和会话 cookie。它看不到来自其他进程的会话 cookie。
    • 在 Vista+ 上,InternetGetCookie 不会从保护模式进程返回 cookie

    http://blogs.msdn.com/b/ieinternals/archive/2009/08/20/wininet-ie-cookie-internals-faq.aspx

    【讨论】:

      【解决方案2】:

      InternetGetCookie 返回以“;”分隔的所有 cookie符号。

      【讨论】:

      • 恐怕id没有:我已经测试过InternetGetCookie,它只检索第一个cookie。
      【解决方案3】:

      它不返回HttpOnly 标记的cookie。查看您的第二个 cookie 是否标记为 HttpOnly。如果是这样,则使用 InternetGetCookieEx()INTERNET_COOKIE_HTTPONLY 标志。

      【讨论】:

        猜你喜欢
        • 2012-04-27
        • 1970-01-01
        • 2016-12-08
        • 2010-10-29
        • 1970-01-01
        • 2019-03-12
        • 2014-01-21
        • 2014-11-15
        • 1970-01-01
        相关资源
        最近更新 更多