Note that there are some explanatory texts on larger screens.

plurals
  1. POProgrammatically set cookies in Internet Explorer
    text
    copied!<p>I'll start by explaining the scenario:</p> <p>I have a IE browser in the computer A. Inside the IE I have a plugin so I can access to the Document Object, so I can grab the cookie in a given time.</p> <p>I want to transfer that cookie to a new browser in a different computer B.</p> <p>In order to start the browser in the new computer B I use the InternetExplorer object, I can control the browser using the object instance, but I don't know how to "inject" the cookie of the first computer A to the newly created IE Browser.</p> <p>I have tried two ways. </p> <ul> <li><p>First, I tried to write the cookie before starting the browser using WinInet API <em><strong>InternetSetCookie</strong></em>.</p></li> <li><p>And Secondly, I tried to intercept the <em><strong>BeforeNavigate2</strong></em> Event and set the cookie in the header of the HTTP request.</p></li> </ul> <p>But none of those have worked :(</p> <p>Is It possible to set a cookie in a new Internet Explorer before navigate to a website and therefore be able to maintain the sesion the user had in his previous computer?</p> <p>Thanks :)</p> <p><strong>UPDATE</strong>: I'm still having this issue and did some other investigations using wireshark.</p> <p>In the case of BeforeNavigate2, the IExplore simply ignore the "Cookie:" value in the header.</p> <p>In the case of InternetSetCookie, it seems it's working properly. It create the same file the regular IExplore navigation creates, but when you go to that page, the IE ignores the file which contains the cookie.</p> <p>The code i'm using to write the cookie is:</p> <pre><code>string cookie = "COOKIEVALUES"; InternetSetCookie("http://www.facebook.com/", "", cookie+";expires=Sat, 08-Jan-2014 00:00:00 GMT"); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload