VenomFangs VenomFangs - 1 year ago 218
C# Question

Internet Explorer - Specify JSessionID by setting Session Cookie via Client Java or C# Code

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.

Answer Source

Use IE automation to set document.cookie.

Here are related questions - and sample here 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...
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download