Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. WebBrowser control displaying security alert dialogs

WebBrowser control displaying security alert dialogs

Scheduled Pinned Locked Moved C#
javascriptdesignsecurityhelptutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GriffonRL
    wrote on last edited by
    #1

    Hello, I'm using the webbrowser control in an application where the crawling is totally automated. The problem is that sometimes the browser try to crawl an archive file or whatever. In that case a security alert dialog box pops up and my webbrowser control waits for this dialog to close. I already succeded removing all Javascript dialogs by implementing the IDocHostShowUI interface and by putting the control into the "silent" mode (put_silent()). I also implemented the IDocHostUIHandler to return S_OK or S_FALSE wherever possible to get rid of a maximum of MSHTML UI unwanted behaviours. But I still get this security alert dialogs and I have no ideas of how to avoid them. The only solution I found for the moment is to filter the links the webbrowser control can crawl in a page by removing files containing 'zip','rar','mp3','jpg','gif'... And so on. But this solution is not perfect because of the number of possible file types and because sometimes you can't even guess what it is from the URL. If only the webbrowser control could allow me to access the HTTP file headers before display, to guess what it is from the content-type ! But even if I can filter the URL I crawl, I would really like a solution to remove the security alert dialogs. I also tried to tweak the Internet Explorer options to avoid prompts and dialogs but I didn't solve this problem. Any idea ? Thanks, R. LOPES Just programmer.

    S 1 Reply Last reply
    0
    • G GriffonRL

      Hello, I'm using the webbrowser control in an application where the crawling is totally automated. The problem is that sometimes the browser try to crawl an archive file or whatever. In that case a security alert dialog box pops up and my webbrowser control waits for this dialog to close. I already succeded removing all Javascript dialogs by implementing the IDocHostShowUI interface and by putting the control into the "silent" mode (put_silent()). I also implemented the IDocHostUIHandler to return S_OK or S_FALSE wherever possible to get rid of a maximum of MSHTML UI unwanted behaviours. But I still get this security alert dialogs and I have no ideas of how to avoid them. The only solution I found for the moment is to filter the links the webbrowser control can crawl in a page by removing files containing 'zip','rar','mp3','jpg','gif'... And so on. But this solution is not perfect because of the number of possible file types and because sometimes you can't even guess what it is from the URL. If only the webbrowser control could allow me to access the HTTP file headers before display, to guess what it is from the content-type ! But even if I can filter the URL I crawl, I would really like a solution to remove the security alert dialogs. I also tried to tweak the Internet Explorer options to avoid prompts and dialogs but I didn't solve this problem. Any idea ? Thanks, R. LOPES Just programmer.

      S Offline
      S Offline
      Stephane Rodriguez
      wrote on last edited by
      #2

      GriffonRL wrote: But even if I can filter the URL I crawl, I would really like a solution to remove the security alert dialogs. I also tried to tweak the Internet Explorer options to avoid prompts and dialogs but I didn't solve this problem. If you have an automatic crawler, why should you have anything displayed while you are crawling ? If you have anything displayed, Internet Explorer runs in "interactive" mode, and I believe ActiveX security boxes are hardwired in this mode. It is possible to use Internet Explorer like a COM dll : see a MSDN sample called "WalkAll".

      G 1 Reply Last reply
      0
      • S Stephane Rodriguez

        GriffonRL wrote: But even if I can filter the URL I crawl, I would really like a solution to remove the security alert dialogs. I also tried to tweak the Internet Explorer options to avoid prompts and dialogs but I didn't solve this problem. If you have an automatic crawler, why should you have anything displayed while you are crawling ? If you have anything displayed, Internet Explorer runs in "interactive" mode, and I believe ActiveX security boxes are hardwired in this mode. It is possible to use Internet Explorer like a COM dll : see a MSDN sample called "WalkAll".

        G Offline
        G Offline
        GriffonRL
        wrote on last edited by
        #3

        Hello Stephane, If I am right WalkAll use MSHTML only not the WebBrowser control. The problem if that I lack a lot of features if I use MSHTML instead of the WebBrowser control. I would need to implement all the navigation stuff and more. Moreover, even if this is an antomatic crawler, I sometimes switch to some manual control. Nevertheless thanks for the answer. Any other idea ? Regards, R. LOPES Just programmer.

        S 1 Reply Last reply
        0
        • G GriffonRL

          Hello Stephane, If I am right WalkAll use MSHTML only not the WebBrowser control. The problem if that I lack a lot of features if I use MSHTML instead of the WebBrowser control. I would need to implement all the navigation stuff and more. Moreover, even if this is an antomatic crawler, I sometimes switch to some manual control. Nevertheless thanks for the answer. Any other idea ? Regards, R. LOPES Just programmer.

          S Offline
          S Offline
          Stephane Rodriguez
          wrote on last edited by
          #4

          GriffonRL wrote: If I am right WalkAll use MSHTML only not the WebBrowser control Yes, I would use monikers to get the content pointed by the URL, retrieve the data then throw it at an actual web browser instance (where I would simply do a IPersistFile->Load(...) or something like that). The fact that you see the data makes you have the opportunity to strip off all messing tags, if required. (you need an html parser). GriffonRL wrote: Any other idea ? Become a hacker :wtf:. You have to find the way to make the Internet Explorer temporarily switch to low-security mode, where ActiveX and stuff are all ok.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups