使用C#如何让任何浏览器只打开一个网站? [英] using C# how to make any browser to open only one site ?

查看:146
本文介绍了使用C#如何让任何浏览器只打开一个网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我正在尝试打开google.com,我的浏览器应该将我重定向到yahoo.com同样尝试打开任何网站浏览器应该将我重定向到yahoo.com怎么做?

解决方案

您可以嵌入 BrowserControl (无论它是什么;它将取决于您的应用程序类型)来实现此类行为。至于任何浏览器,问题甚至没有意义。原因如下:1)这不是现有浏览器的行为;即使你再修改一个现有产品,它也不会是任何; 2)如果您不修改某些浏览器产品,它将按照定义浏览到任何网站; 3)如果你以这种方式修改任何浏览器,它就不能再被称为浏览器了。 :-)



您只能通过阻止和重定向某些网络系统上的整个网络流量来实现。例如,您可以隐藏代理背后的外部世界: http://en.wikipedia .org / wiki / Proxy_server#Web_proxy_servers [ ^ ]。



无论如何,整个要求看起来像完全肮脏的忙碌;这是我答案的主要部分。如果所有内容都被重定向到Yahoo,为什么需要Web,如果所有Yahoo链接被阻止,谁需要Yahoo?



-SA

正如亚历山德罗维奇先生所说,只有设置代理才能实现。如果你想要同样可以通过在C#中动态使用System.Net.GlobalProxySelection和System.Net.WebProxy类来实现。



请在这里阅读:http://stackoverflow.com/questions/197725/programmatically-set-browser-proxy- settings-in-c-sharp [ ^ ]


if i am trying to open google.com, my browser should redirect me to yahoo.com likewise trying to open any site browser should redirect me to yahoo.com how to do it?

解决方案

You can embed BrowserControl (whatever it is; it will depend on your application type) to implement such behavior. As to the "any browser", the question does not even make sense. Here is why: 1) this is not the behavior of the existing browsers; even if you modify one more of existing products, it won't be "any"; 2) if you don't modify some browser product, it will browse to any Web site, by definition; 3) if you do modify any of the browsers in this way, it cannot be called "browser" anymore. :-)

You can only do it by blocking and redirecting the whole network traffic on some system of network. For example, you could can hide the outer world behind a proxy: http://en.wikipedia.org/wiki/Proxy_server#Web_proxy_servers[^].

Anyway, the whole requirements looks like totally dirty busyness; and this is the main part of my answer. Why needs the Web if everything is redirected to Yahoo, and who needs Yahoo if all Yahoo links are blocked?

—SA


As Mr.Alexandrovich said, It can be achieved only by setting the proxy . If you want the same can be achieved by using System.Net.GlobalProxySelection and System.Net.WebProxy classes in C# dynamically.

Please read here : http://stackoverflow.com/questions/197725/programmatically-set-browser-proxy-settings-in-c-sharp[^]


这篇关于使用C#如何让任何浏览器只打开一个网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆