WebBrowser Control loses session state . . . RESOLVED (well, kind of . . .)
Hey guys (and gals),
Haven't posted in a bit, but I really need your help with something. I have an application that we are planning to use to host our Oracle portal page. The application has a WebBrowser control that navigates to our portal page where the user logs in. When the user clicks on a link in the WebBrowser control that opens and external page, they have to log in again. Basically the new link opens a new IE window in a new process thread and the WebBrowser control does not pass the session state to the new IE instance.
MSDN recommends creating a new instance of a form that has a WebBrowser control to open the newly spawned IE link request like so . . .
VB Code:
Private Sub wbPortal_NewWindow2(ppDisp As Object, Cancel As Boolean)
' ppDisp: A pointer to the IDispatch interface of a WebBrowser
'or InternetExplorer object. You set this pointer equal to the
'IDispatch interface of a new or existing WebBrowser or
'InternetExplorer object.
Dim frmWB As frmBrowser
Set frmWB = New frmBrowser
With frmWB
.WebBrowser1.RegisterAsBrowser = True
Set ppDisp = .WebBrowser1.object
.Visible = True
End With
Set frmWB = Nothing
End Sub
This works, but not so well for specifically sized windows opened through javascript instead of links. I really want the new window to open in IE but maintain session state. I have seen code posted, but it simply doesn't work . . .
VB Code:
Dim ie As InternetExplorer
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Set ie = Nothing
Set ie = New InternetExplorer
With ie
.RegisterAsBrowser = True
Set ppDisp = ie.Application
ppDisp.Visible = True
End With
End Sub
This will open the new IE window and it does handle popups correctly, but session state is lost and the user needs to re-login on the new page.
MSDN states . . .
Quote:
ppDisp: A pointer to the IDispatch interface of a WebBrowser
or InternetExplorer object. You set this pointer equal to the
IDispatch interface of a new or existing WebBrowser or
InternetExplorer object.
which seems like the key to me, but I just came seem to put all the pieces together.
HELP!
Thanks in advance . . .