I am having a bit of trouble trying to save the cookies i receive in my .NET application onto IE cookie store.
I have a request (with other parameters, not shown)
HttpWebRequest request = HttpWebRequest.Create(RequestString) as HttpWebRequest;
the response gets cookies.
[DllImport("wininet.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool InternetSetCookie(string UrlName, string CookieName, string CookieData, uint dwFlags, IntPtr dwReserved);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
foreach (Cookie cookie in response.Cookies)
{
InternetSetCookie(cookie.Domain, cookie.Name, cookie.Value, 2147484672, IntPtr.Zero);
}
I tried to follow Writing cookies from CookieContainer to the IE cookie store but i am not able to get InternetSetCookie to work. It just doesn't seem to create cookies locally.
Any suggestions?