Read cookies in Temporary internet files.

Add-in Express™ Support Service
That's what is more important than anything else

Read cookies in Temporary internet files.
 
Aswathi aswathi




Posts: 9
Joined: 2010-09-06
Hello,

In HTMLDocument.co okie i can get the current page cookies. But i need to read another domain cookies.

For example, my current web page as a.com. I need to read the cookies in b.com.

Is it possible to read the cookies like that? in which object we can read that.


Thanks,
Posted 16 Sep, 2010 02:21:46 Top
Eugene Astafiev


Guest


Hi Aswathi,

Please try using the http://msdn.microsoft.com/en-us/library/system.net.cookie.aspx class.
Posted 16 Sep, 2010 05:31:44 Top
Aswathi aswathi




Posts: 9
Joined: 2010-09-06
Hello Eugene,


Thank you for your response. I tried the same. It is working when the button click event. But i need to read the cookie in DocumentComplete event. This event triggered more then one time when page loading. So it's get timed out. So i couldt get the cookies. What is the issue for DocumentComplete event trigger more then one time when page loading ? How can i avoid this ?


Thanks,
Posted 16 Sep, 2010 07:29:33 Top
Eugene Astafiev


Guest


Hi Aswathi,

Does the document you are loading contain several iframes? For example:

DocumentComplete(object pDisp, string url)


You can check out the url of the document. Is it always the same?
Posted 16 Sep, 2010 07:41:43 Top
Aswathi aswathi




Posts: 9
Joined: 2010-09-06
Hi,

Thanks for your response. Yes my web page contain several iframes.

I checked the url of the document it shows different url's.

So can we avoid to load several times?
Posted 17 Sep, 2010 00:06:13 Top
Eugene Astafiev


Guest


Hi Aswathi,

Yes, you can. You just need to differentiate the main HTML document and iframes in the event handler. The DocumentComplete event is fired for all iframes.
Posted 17 Sep, 2010 05:25:38 Top
Justin Ricci




Posts: 14
Joined: 2010-08-12
Consider using the COM functions to get cookies for a url:


/* get's cookie from the http store */
        [DllImport("wininet.dll", SetLastError = true)]
        public static extern bool InternetGetCookie(string url, string cookieName, StringBuilder cookieData, ref int size);

        /* get's the cookie with extended parameters for thirdparty/http only cookies */
        [DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)]
        static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref int pcchCookieData, int dwFlags, object lpReserved);


here's a helpful site:
http://www.pinvoke.net/default.aspx/wininet/InternetGetCookie.html
Posted 21 Sep, 2010 15:45:11 Top