Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

C# Express

Hi am a totaly newbie to windows programming and have just downloaded the new Express Edition

When using the WebBrowser Class and opening web pages which require loggin based on HTTP sessions it works untill the web page opens a pop-up window.
eg. the session does not work in the pop up.

Is this a bug or do I have to provide some extra code?

just testing
Wednesday, June 30, 2004

This is just a guess, but when a pop-up window comes up (if I understand you correctly), you get a new WebBrowser control, which would most likely look like a new session to the website you're browsing to.

Greg Hurlman
Wednesday, June 30, 2004

Try doing something like this.

        // event called on "open in new window" right-clicks or popups open sequence
        private void OnNewWindow2EventHandler(object sender,
            AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e)
        {
            Form1 newwindow = new Form1();
            newwindow.axWebBrowser1.WindowSetHeight += new AxSHDocVw.DWebBrowserEvents2_WindowSetHeightEventHandler(newwindow.axWebBrowser1_WindowSetHeight);
            newwindow.axWebBrowser1.WindowSetWidth += new AxSHDocVw.DWebBrowserEvents2_WindowSetWidthEventHandler(newwindow.axWebBrowser1_WindowSetWidth);
            newwindow.Text = "Your Application Name";
            // send back this instance to the caller
            e.ppDisp = newwindow.axWebBrowser1.Application;
            // finally show the window
            newwindow.Show();
        }
       
        private void axWebBrowser1_WindowSetHeight(object sender, AxSHDocVw.DWebBrowserEvents2_WindowSetHeightEvent e)
        {
            int heightDiff;
            heightDiff = this.Height - this.axWebBrowser1.Height;
            this.Height = heightDiff + e.height;
        }

        private void axWebBrowser1_WindowSetWidth(object sender, AxSHDocVw.DWebBrowserEvents2_WindowSetWidthEvent e)
        {
            int widthDiff;
            widthDiff = this.Width - this.axWebBrowser1.Width;
            this.Width = widthDiff + e.width;
        }

Joshua Yates
Thursday, July 15, 2004

*  Recent Topics

*  Fog Creek Home