Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何读取web浏览器中正在搜索的内容并将其返回到MessageBox?_.net_Vb.net_Url Redirection_Traffic - Fatal编程技术网

.net 如何读取web浏览器中正在搜索的内容并将其返回到MessageBox?

.net 如何读取web浏览器中正在搜索的内容并将其返回到MessageBox?,.net,vb.net,url-redirection,traffic,.net,Vb.net,Url Redirection,Traffic,我有一个应用程序,我正在使用它来练习,它可以将流量从某个网站重新定向到另一个网站 例如 1. User opens a web-browser and types in a link like "www.youtube.com". The user presses 'enter' and they're forwarded to www.youtube.com. 2. User opens a web-browser and types in a link like "www.youtube

我有一个应用程序,我正在使用它来练习,它可以将流量从某个网站重新定向到另一个网站

例如

1.

User opens a web-browser and types in a link like "www.youtube.com".
The user presses 'enter' and they're forwarded to www.youtube.com.
2.

User opens a web-browser and types in a link like "www.youtube.com".
The user presses 'enter' and they're forwarded to www.youtube.com.
现在,如果我不想访问这个网站,我想将搜索重定向到另一个域怎么办?我该怎么做?它看起来像这样吗

Dim website As "www.youtube.com"
If website.IsSearched = True Then
MesssageBox.Show("This site is whitelisted.")
我知道这段代码将不起作用,但是,这是我试图实现的一个简单示例

任何对项目的帮助或参考都会很好

要将搜索重定向到其他域吗

你可以使用hosts文件,它可以覆盖dns,让浏览器相信youtube.com的IP地址是你想要的。您可以将其重定向到127.0.0.1,在那里您可以像代理一样自己处理传入的请求,并返回编辑后的响应。Https显然不起作用,因为你不是真正的youtube.com,但http会起作用


tldr;这不是.net问题

在webbrowser导航事件中执行此操作。
当用户按enter键时,导航将启动,然后您可以检查url并执行任何操作。

据我所知,您有两个选项:1)为您希望应用插件的每个web浏览器创建插件(假设您可以以这种方式与它们交互),或2)创建防火墙。|后者当然是最高级的,因为它需要了解C/C++和WFPAPI(Windows过滤平台)。前者取决于目标浏览器要求您使用的技术。总的来说,你所要求的并不是容易实现的。你需要围绕这个主题做很多研究。