开发者

How to block a website using C#

开发者 https://www.devze.com 2022-12-08 07:19 出处:网络
Hai I am developing an C# application(not asp.net) in which I have to get the urls typed by the user in the browser and I have to compare the urls with a set of urls and decide whether to allow or to

Hai I am developing an C# application(not asp.net) in which I have to get the urls typed by the user in the browser and I have to compare the urls with a set of urls and decide whether to allow or to deny the user to navigate to the website. I have tried with appending to C:\windows\system32\drivers\etc\hosts file but its no开发者_运维技巧t working.So Is there any way I can do this?How to block the sites by getting the urls.Can someone suggest me how to approach to the solution with some sites or code that can help me.

Thank You Chaithu


You're going about it the wrong way. You don't want to intercept at the browser level - I'll use a browser or method you've never heard of to get where I want to go. You need to go deeper. Own the network interface or the operating system's network communication (e.g. the hosts file as people said) and authenticate each connection. Ideally, own it outside of the computer - at the network infrastructure level.


The easiest way is to modify the hosts file, but that means the app has to run with administrator access.


Basically you want a proxy server with a black list?

0

精彩评论

暂无评论...
验证码 换一张
取 消