• 0

[c#.NET] blocking access to a web page through a desktop app


Question

Hi just wondering if anyone could help, I want to create a desktop application that will run in the background and block access to certain sites what I was wondering, is it possible for an application to stay in the background and stop access to a website, sort of like a net nanny?

if so how can I do it in C# I've had a look on google and can't seem to find any information doing it through C#

thanks in advance

Matt

5 answers to this question

Recommended Posts

  • 0

Why not use the hosts file? All you need to do is add:

127.0.0.1 blockedwebsite.com

or similar to it and it will effectively block any website from blockedwebsite.com from loading.

If you want a background process, you want to create a service program and register it as a service. Take a look at ServiceBase class for a starting point.

http://blogs.msdn.com/bclteam/archive/2005/03/15/396428.aspx

Edited by Xilo
  • 0

we'll I'm researching how to do it securely and trying to stop it from being easily fixable. Really i'm looking for net nanny style app that once a said person has entered an application only retyping in the password again is able to unlock it for restriction free browsing?

  • 0

Well the easiest way would be to make your application read from/write to the HOSTS file, then use a FileSystemWatcher object to keep an eye on the HOSTS file. If the user tries to change it, you can just change it back and undo their changes.

Its a hack, but much easier than intercepting outgoing HTTP packets IMO.

  • 0

Right thanks guys, think as a last resort I may go with HOST files. just trying to get as many ways as possible so am able to test and research them out

any more suggestions would be greatly appricated

thanks

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.