Jonathan
Jonathan

Reputation: 3034

Making a webpage-blocking application in C#

I have a school project with a friend of mine and we are developing a software product (in C#) that reads a value from a hardware sensor through serial com (from arduino). Depending on that value we want to be able to blacklist certain ips and domains and re-route them to a htmlfile that informs the user that that webpage has been blocked.

What methods are there? The only thing we come to think about so far is just use simple filehandling and edit the .hosts file, but thats not flexiable at all really. Is there maybe an api for the windows firewall or something like that can be used?

Thanks in advance

Upvotes: 1

Views: 4249

Answers (1)

Adam
Adam

Reputation: 16199

Controlling the windows filewall can easily be done through COM: http://www.shafqatahmed.com/2008/01/controlling-win.html

However that isnt going to get you to redirect to a certain page.

If you want to redirect to a page you would have to intercept all traffic. I assume HTTP. So you can either put an application that listens on port 80 and redirects, or use sockets.

More information sniffing packets can be found here: http://www.techpowerup.com/forums/showthread.php?t=61792

Upvotes: 2

Related Questions