reading cookies

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

reading cookies
reading cookies 
paul moore




Posts: 5
Joined: 2013-01-31
Can I read all cookies that the browser knows about

I know how to read the current pages cookies but I want to see all cookies that the browser knows about
Posted 31 Jan, 2013 17:45:42 Top
Sergey Grischenko


Add-in Express team


Posts: 7202
Joined: 2004-07-05
Hi Paul,

Please try the code below:

ArrayList entries = ADXIEHelper.FindCacheEntries("^[Cookie:]");
if (entries.Count > 0)
{
foreach (ADXIEHelper.ADXIECacheEntry entry in entries)
{
}
}
Posted 01 Feb, 2013 13:46:55 Top
paul moore




Posts: 5
Joined: 2013-01-31
this does not get session cookies.

also is there some description of how to parse the .txt file
Posted 04 Feb, 2013 11:18:09 Top
Sergey Grischenko


Add-in Express team


Posts: 7202
Joined: 2004-07-05
Hi Paul,

Session cookies are not stored in the cache. To get session cookie you can use the 'cookie' property of the HTML document.

also is there some description of how to parse the .txt file

To open text files you can use the FileStream or StreamReader .NET classes.
Posted 05 Feb, 2013 08:28:29 Top
paul moore




Posts: 5
Joined: 2013-01-31
document.cookie gets the cookie for the current page. I need access to session cookies for other pages (chrome can do it)
Posted 05 Feb, 2013 17:07:27 Top
Sergey Grischenko


Add-in Express team


Posts: 7202
Joined: 2004-07-05
Hi Paul,

To access document.cookie in all opened IE tabs/windows you can use the 'GetModulesByTypeName' static method of iemodule.

E.g.
// The public method of the IEModule class
public string GetSessionCookie()
{
return this.HTMLDocument.cookie;
}

private void LoadCookie()
{
IEModule module;

ArrayList modules = AddinExpress.IE.ADXIEModule.GetModulesByTypeName(this.GetType().FullName);
for (int i = 0; i < modules.Count; i++)
{
module = modules[i] as IEModule;
if (module != null)
{
string cookie = module.GetSessionCookie();
}
}
}
Posted 06 Feb, 2013 07:24:43 Top