CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13
  1. #1
    Join Date
    Nov 2013
    Location
    Florida
    Posts
    10

    [RESOLVED] how to stop msgbox opening within webbrowser when connected to website

    I am using the webbrowser control in a windows application. when I go to our college website portal and login, do some work, then logout, I get a windows message box Yes/Cancel/Quit that I want to intercept then close browser inside my code. if I click on quit then the browser hangs and does not close.
    this is not the AxWebbrowser. is there any way to intercept this message box?

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: how to stop msgbox opening within webbrowser when connected to website

    Well, yes, but this is a tad against the AUP of this site. Can you post some code that you have so far ?

  3. #3
    Join Date
    Nov 2013
    Location
    Florida
    Posts
    10

    Re: how to stop msgbox opening within webbrowser when connected to website

    sorry about that, there is not much to post for code since this was a simple form1, webbrowser, textbox and a button.
    this is the only code:
    Public Class Form1
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    WebBrowser1.Navigate(TextBox1.Text)
    End Sub
    End Class

    when run the program, I type in the url in this case our college portal which requires login credentials, then when I log out of the portal it cause a popup message box as described in previous post. when I click quit since it is required to logout of the portal it hangs up because I did not intercept the message boX from my code. the attached message is shown during hang.

    Name:  MustCloseBrowser.JPG
Views: 3997
Size:  15.1 KB

  4. #4
    Join Date
    Nov 2013
    Location
    Florida
    Posts
    10

    Re: how to stop msgbox opening within webbrowser when connected to website

    Just checking in to see if anyone can help with this.

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: how to stop msgbox opening within webbrowser when connected to website

    why not just sign out, first. then close the browser
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Nov 2013
    Location
    Florida
    Posts
    10

    Re: how to stop msgbox opening within webbrowser when connected to website

    Quote Originally Posted by dglienna View Post
    why not just sign out, first. then close the browser
    The portal was written by a web designer who put the messagebox in the logout routine so I do click logout and then it pop's up. Too late then to cancel. I asked the person who wrote it and she said it is required to exit from portal on back end.

  7. #7
    Join Date
    Nov 2013
    Location
    Florida
    Posts
    10

    Re: how to stop msgbox opening within webbrowser when connected to website

    Quote Originally Posted by HanneSThEGreaT View Post
    Well, yes, but this is a tad against the AUP of this site. Can you post some code that you have so far ?
    I reread the AUP but do not see what you are talking about not posting the code, please enlighten me. Also, I have not found a resolution so can you tell me how to intercept the message box.

  8. #8
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: how to stop msgbox opening within webbrowser when connected to website

    He 'suggested' that you could re-write their page, and send it back, but. Against the AUP and all
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  9. #9
    Join Date
    Nov 2013
    Location
    Florida
    Posts
    10

    Re: how to stop msgbox opening within webbrowser when connected to website

    Quote Originally Posted by dglienna View Post
    He 'suggested' that you could re-write their page, and send it back, but. Against the AUP and all
    Oh. I see and I will not do that. I think their is a way to look at the webbrowser. Document to do this or maybe use the api or something like find the where the window is about to open where I could send the ok response. There should be a way to find out the website sent me the msgbox open request. I can determine the next url by using the mouse click response on the web document.

  10. #10
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: how to stop msgbox opening within webbrowser when connected to website

    Not if it's ASP.Net. Server side code isn't visible
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  11. #11
    Join Date
    Nov 2013
    Location
    Florida
    Posts
    10

    Re: how to stop msgbox opening within webbrowser when connected to website

    I talked with the web master who manages our site and it appears that when we logout the portal it causes the message box on exit which states:
    "The webpage you are viewing is trying to close the window. Do you want to close this window? YES/NO"
    she said this is necessary to close the connection to the website because we use ADFS for single sign on and that will not disconnect until the browser is closed.
    she is looking at an alternate method. Is there anyone who can suggest how she should be closing the portal on the ASP side of the house.
    This is the code I see when viewing the source from the client browser:
    <ie:menuitem id="zz7_ID_Logout" type="option" onMenuClick="STSNavigate2(event,'/_layouts/SignOut.aspx');" text="Sign Out" description="Logout of this site."

  12. #12
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: how to stop msgbox opening within webbrowser when connected to website

    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  13. #13
    Join Date
    Nov 2013
    Location
    Florida
    Posts
    10

    Re: how to stop msgbox opening within webbrowser when connected to website

    I asked about it and we dug deeper and found that we are using sharepoint and it has a built in "sign out" routine that we do not know how to modify it.
    So I posted a question about this in the SharePoint forum to see if I get a response. Nothing yet.
    I will say that this is complete now since there is no way to intercept the popup message box or close the windows when it pops up using VB that I know of.
    Thanks to everyone.

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

Featured