I can't use websocket inside .net (vb.net) web

2020-03-30 05:08发布

问题:

I'm trying to run an webpage inside a Webbrowser control wich contains a connection to an Websocket. The control can't connect to the Websocket. When I tested in IE, everything runs ok, but in the Webbrowser control inside Visual Studio, the page can't connect to the Websocket. I tried other pages that contains script to detect browser support for Websockets, when it runs in IE, the page show that Websocket runs with success, but when I'm try to run the same page on Webbrowser control, the page says that webcontrol can't run. How can I do to solve this problem? Very thank you.

回答1:

The problem is that the webbrowser control, while using the local IE as a basis, is more locked down (or maybe better to say "differently configured") by default.

The ability to control this is called Feature Control and you can read about it on MSDN here

In terms of solving your actual problems, a similar question has been solved with code provided in this answer to an equivalent question on C#. Note the tweaks in the subsequent answer as well.