0

In my code, I have a JSessionID, which I want to share with an IE instance.

I am able to launch an instance of IE, however I need to specify the JSessionID to the browser. The application server will be JBoss, WebSphere or WebLogic, so I am looking for a solution that sets the value via a session cookie (via local java or C# code, not server based code).

Please note that setting the JSessionID via the url or server does not help me for my scenario.

James Oravec
  • 19,579
  • 27
  • 94
  • 160

1 Answers1

1

Use IE automation to set document.cookie.

Here are related questions - https://stackoverflow.com/search?q=%5Binternet-explorer%5D+automation and sample here http://www.c-sharpcorner.com/UploadFile/gcorrell/IEInstance12062005003909AM/IEInstance.aspx. Some documentation links - IWebBrowserApp and Document.cookie.

SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();
IWebBrowserApp wb = (IWebBrowserApp) ie;
wb.Visible = true;
//Do anything else with the window here that you wish
wb.Navigate(url, ref o, ref o, ref o, ref o);
// add code to wait for navigation to complete... 
// i.e. by waiting for NavigateComplete2  event, or simply sleep...
wb.Document.cookie="....";
Community
  • 1
  • 1
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179