I need to write a program to block certain URLs when web browsing, but I
have not been able to really find anything to help. I was hoping to have a
service running in the back that can check browser windows and compare the
URLs then post a message and shut down the web page if it matches....Any one
have a good starting point for me.
TIA
Dave
That sounds like the job of a proxy server or a firewall...
The problem with using browser windows is that, how are you going to
know the window for every possible browser... So, you hook IE, but what
if the user decides to fire up Firefox (my fav!) or Mozilla or Opera or
.... No, the only way to do this (unless you know that you will always
be dealing with only one browser) is really to intercept outbound traffic
in the form of a proxy as stated above, or on the low level like a
firewall. The low level would involve the use of raw sockets to sniff
all outbound traffic, and you would probably have an easier time doing
that in C# the VB.NET...
If you know it's always going to be one browser, then you would probably
need to do a system wide hook to recieve all messages related to the
creating of top level windows... Probably WH_SHELL would be the best
choice, since it would only send you notifications for top level
windows, and not for every dialog, button, and menu in the system. But,
that would mean that you would have to step outside of .NET for the
actual hook since this kind of hook must reside in a standard non-com
dll.
Is there some reason that you can't use one of the many available
solutions to this?