简体   繁体   中英

how to handle http requests from a browser using c#

我有一个用c#.Net开发的Windows应用程序,它用作网络的网站阻止程序。我是通过修改hosts文件来完成的。当URL被阻止时,如“ www.yahoo.com”,它可以正常工作。是我必须基于关键字来阻止网址。即,当用户在浏览器中键入“ yahoo”时,我应该验证关键字并阻止相应的网站。现在如何跟踪用户在浏览器中键入的网站并根据url阻止或允许用户访问特定网站。如果存在关键字,则不应允许用户查看该页面。如何执行此操作?有人可以帮助我执行此操作吗?

There's plenty of code samples out there that will act as proxies (eg. http://code.cheesydesign.com/?p=393 ) however I would strongly suggest following the advice of the comments you've been given and go with an existing application.

Building a proxy that will not interfere with the complicated web apps of today is not trivial. You also need to be careful about blocking based on keywords - web apps I've worked on have failed in spectacular ways due to proxies doing this, and rejecting requests for important javascript files (often due to minification or compression) rendering our app useless.

Also consider that your proxy won't be able to check SSL traffic (which is increasing all the time) without serving up your own certs acting as a man-in-the-middle.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM