I'am trying to store a value of Document.cookie into a string variable in my c# code. The idea here is to go through each tab in an Internet Explorer browser and then get the cookie information from the tab. So I have got the following,
ShellWindows iExplorerInstances = new ShellWindows();
bool found = false;
foreach (InternetExplorer iExplorer in iExplorerInstances)
{
if (iExplorer.Name == "Internet Explorer")
{
string cookie = iExplorer.Document.cookie;
Now this works upon initial running of the code, but when it is run in the same session again it fails and hits NotSupportDeskException on the last line of code above, which is where the string cookie is declared and initialised (line 134). Is there a way around this?
The stack trace is as follows, at System.Dynamic.ComRuntimeHelpers.CheckThrowException(Int32 hresult, ExcepInfo& excepInfo, UInt32 argErr, String message) at CallSite.Target(Closure , CallSite , ComObject ) at CallSite.Target(Closure , CallSite , Object ) at hhsoutlookadin.ThisAddIn.d__3.MoveNext() in Somefile.cs:line 134. The message is "Exception from HRESULT: 0x800A01B6".