How to set and delete cookies from WebBrowser Control for arbitrary domains

后端 未结 6 2197
你的背包
你的背包 2020-12-05 21:03

How can I set and delete cookies for a domain in webbrowser control without using Javascript (which doesn\'t allow to set / delete cookies without navigating to the webs

6条回答
  •  旧时难觅i
    2020-12-05 21:19

    Here's a finer solution that only clears cookies (C/C++):

    #include 
    #include 
    ...
    DWORD dwSuppress = INTERNET_SUPPRESS_COOKIE_PERSIST;
    InternetSetOption(0, INTERNET_OPTION_SUPPRESS_BEHAVIOR, &dwSuppress, sizeof(DWORD));
    

    All credits to this blog post (C#). Don't forget to check the documentation for InternetSetOption and INTERNET_SUPPRESS_COOKIE_PERSIST

提交回复
热议问题