Internet Explorer WebBrowser Control loses state when JScript performs a call to Window.Open

Session state for a web site is often stored in cookies.  If you use the WebBrowser control in an program and the target website responds to an action with a call to Window.Open, then mysteriously the cookies for that site are not transmitted with the request.

Cause:  
Window.Open creates a window using the IExplore.exe process since it does not have a parent window handle.  You cannot share cookies across processes.

Correct methods to use:

1. Change the jscript

You can change the jscript to use the parent application window handle and that will host that window in your application’s process. 

function MyShowModal()
{
                var args = new Object;
                args.window = window;
                showModalDialog("modal.asp", args);
}

2. Your application can host the New Window

If your application goes to web sites that are not under your control, you handle the NewWindow2 event from the browser control as covered in these KB articles:

How To Use the WebBrowser Control NewWindow2 Event  
https://support.microsoft.com/kb/184876/EN-US/

How to use the WebBrowser control NewWindow2 event in Visual Basic .NET .Net Version: https://support.microsoft.com/kb/311282/EN-US/

How to use the WebBrowser control NewWindow2 event in Visual C# .NET or in Visual C# 2005
https://support.microsoft.com/kb/815714

Related article:
How to maintain the ASP.NET session state
https://support.microsoft.com/kb/932474