The handling of cookies in Internet Explorer (or hosted versions) is tied to IE's own concept of "URL Security Zones", doc here: About URL Security Zones
In this way, IE defines a URL zone using various algorithms applied to the URL. Depending on the zone, your hosted browser may or may not support session or persistent cookies.
It's strange when I create a small WPF sample, add a web browser to it and go to this constant cookie test using the page: http://www.rbaworld.com/Security/Computers/Cookies/givecook.shtml , it works great. Every time I run the sample application, the counter increments in order, so not everyone can reproduce your problem. Itβs good that the whole purpose of URL security zones is: it can vary depending on the machine, user, Windows policy, etc.
The next question is: can I change the zone in which you work? The short and simple answer is no, because it is strongly tied to security.
If you host IE yourself, you can implement your own security zone descriptor, as described here: Deploying a custom security manager and sample here: SAMPLE: Secumgr.exe overrides Security Manager for WebBrowser Host , but you rely on a WPF web browser that doesn't allows you to override ... You can go to Reflector and copy all the closed / internal WPF code, but this is a risky work log!
The last thing you can try is to manipulate the standard Internet Security Manager. Here is a sample code that gives some hints. At the very least, you should be able to determine the zone in which you work (MapUrltoZone) and change the cookie (TryAllowCookie). The problem with the standard manager in most cases, it opens a dialog for the end user allowing authorization ... (security again!):
[ComImport, Guid("7b8a2d94-0ac9-11d1-896c-00c04Fb6bfc4")] private class InternetSecurityManager { } [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("79eac9ee-baf9-11ce-8c82-00aa004ba90b")] private interface IInternetSecurityManager { void Unused1(); void Unused2(); [PreserveSig] int MapUrlToZone([In, MarshalAs(UnmanagedType.BStr)] string pwszUrl, out int pdwZone, [In] int dwFlags); void Unused3(); [PreserveSig] int ProcessUrlAction(string pwszUrl, int dwAction, ref int pPolicy, int cbPolicy, ref Guid pContext, int cbContext, int dwFlags, int dwReserved);
Good luck :)