Results 1 to 8 of 8

Thread: WebBrowser Control loses session state . . . RESOLVED (well, kind of . . .)

Threaded View

  1. #1

    Thread Starter
    Fanatic Member Armbruster's Avatar
    Join Date
    Sep 2002
    Location
    Maryland Heights, MO
    Posts
    857

    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:
    1. Private Sub wbPortal_NewWindow2(ppDisp As Object, Cancel As Boolean)
    2. '    ppDisp: A pointer to the IDispatch interface of a WebBrowser
    3.     'or InternetExplorer object. You set this pointer equal to the
    4.     'IDispatch interface of a new or existing WebBrowser or
    5.     'InternetExplorer object.
    6.     Dim frmWB As frmBrowser
    7.     Set frmWB = New frmBrowser
    8.    
    9.     With frmWB
    10.         .WebBrowser1.RegisterAsBrowser = True
    11.         Set ppDisp = .WebBrowser1.object
    12.         .Visible = True
    13.     End With
    14.     Set frmWB = Nothing
    15. 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:
    1. Dim ie As InternetExplorer
    2.  
    3. Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    4.     Set ie = Nothing
    5.     Set ie = New InternetExplorer
    6.     With ie
    7.         .RegisterAsBrowser = True
    8.         Set ppDisp = ie.Application
    9.         ppDisp.Visible = True
    10.     End With
    11.    
    12. 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 . . .

    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 . . .
    Last edited by Armbruster; Aug 26th, 2004 at 06:11 PM.
    "Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!

    Resistance is futile, you will be compiled . . . Please!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width