Search code examples
c#urlfilterblock

How to block a website dynamically in C#?


I would like to block certain URLs dynamically from Windows Service written in C#. I don't want to do this by writing to hosts file.

For example I would like to block the url http://example.com (in all browsers), but also block http://example.com/another from 7 to 8 am.

Is this possible, what should I do?

Best regards, Andrew


Solution

  • You might be able to use the Windows Firewall API. See the article, Managed classes to view/manipulate the Windows Firewall, by John Cole.