Click here to Skip to main content
13,298,175 members (79,800 online)
Rate this:
Please Sign up or sign in to vote.
See more:
hello !
i am working on a small application ,through which i can block any website on my computer , means if i want to block youtube or yahoo at my computer then no one can able to visit them using any webbrowser , is this possible in or in c#

Posted 26-Jul-12 20:08pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I would say: don't do evil. And please don't tell me that you have this feature as a requirement; I don't care.

You can do it only if you assume that the person installing this "tool" has more advanced privileges than a user. In what settings it could be the case? In all companies I ever knew all employees always get administrative privileges for their local systems on first request. If this is not the case — everything you can block on my computer I can unblock.

badbaoy 31-Jul-12 10:57am
well Sergey Alexandrovich .i dont need any type of suggestion from you . i asked a simple question if you have proper answer then give it if you dont have any solution for this prob then please do not tell me what to do .
and by the way who you are to unblock everything on my computer :P , well i dont want to use any harsh word for you :P because i think there is nothing to say for fools :P.
I am working on a simple computer lab management application , this application has LAN chat , Usb Blocking , and Site restrictions.

Sergey Alexandrovich Kryukov 31-Jul-12 11:46am
I would I care if you need it or not? This is pretty rude of you. You asked for an advice; and this is enough for me. And by the way, 1) this is a really good advice, a practical one, but it takes some understanding; 2) I actually answered you "simple" question in second paragraph, and this is the only valid thing about it.

You should have some logic to understand that a negative solution is still a solution. You aren't a kid who would cry about a toy he cannot get, aren't you?

I know that this is useless, but calling me a fool and maintaining that you don't want harsh words is just funny. It is very usual that such rudeness is only possible in extremely incompetent and illiterate people. Welcome to the club!

@AmitGajjar 12-Jun-13 8:32am
Hi SA,
Although this is very old post but actually i have similar functionality to achieve. In my case, i have shared internet from my server to other computers. I want to restrict all other computers to access on community site. Can i filter all incoming request from client computers from server using c# ?

Sergey Alexandrovich Kryukov 12-Jun-13 13:08pm
I don't see how it is similar, only remotely. Basically, your requirements may have sense, but one by OP — hardly. I think you can only filter out access by IP, as your server receive client IP, or, of course, by authorization. IP is absolutely reliable, but this is a shaky matter: most users won't have static IPs. Very often, IP will be assigned dynamically:

It means, the same user may have different IPs: due to dynamic assignment, or due to the fact the same person can access the site from different computers or move a computer from one network to another. With WiFi, for example, it may happen all the time. And, due to dynamic assignment, different user can get the same IP.

Now, if all your users are from the same organization with more or less well-defined administration, you can set it up with network administrators, to filter IPs by some allowed subset of addresses. I don't know, it will depend on your organization's setting. Consult those people, they can set up you a solution based on this idea: they will guarantee that your organization users will get some certain IP subset, and you will put it in your configuration. Does it make sense to you?

@AmitGajjar 13-Jun-13 0:13am
Thanks for your detailed explanation. Certainly you are correct. For big organization they can afford IT Administrator who could setup server and maintain on daily basis. In my case we have so many small firms who could not hire them. So i suggest them to develop a software that can be integrated in their existing software and it can do filtration of some porn sites. Please suggest some solution so i can integrate in the existing C# application. I can add one menu in the application where company head can add restricted sites very easily from the proxy computer. Hope you got some idea about my problem.

Thanks again for your effort.
I would suggest you formulate it as a separate questions. I have a little concern with network administration issues (and I even against any thinkable limitations in Internet usage). Filtering is very different from what we discussed so far and I think is much simpler. You will be able to find a lot of solutions if you Google.
@AmitGajjar 13-Jun-13 0:23am
No problem. Thanks you very much SA.

I will try my best from Google/MSDN :)
@AmitGajjar 13-Jun-13 0:24am
i have one question. are you slipping or not. All the time i can see you online in the codeproject ;)
Come on, this is just the illusion...
@AmitGajjar 13-Jun-13 0:32am
I don't think so. I think you are very passionate about helping people so this all your work is like fun for you.

I really would like to thank you for all your contributions.

Thank you for your nice words, Amit.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

here is full code

Public Function IPAdress(ByVal CompName As String) As String
myIPs = System.Net.Dns.GetHostByName(CompName)
For Each myIP As System.Net.IPAddress In myIPs.AddressList
add = myIP.ToString
Return add.ToString
End Function
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
    End Sub
    Sub Blocked()
        IO.File.AppendAllText("\\" & HostName.ToString.Trim & "\C$\windows\system32\drivers\etc\hosts", vbNewLine & IPAdress(HostName).ToString & vbTab & TextBox2.Text.Trim)
        MessageBox.Show("Site Blocked")
  End Sub

thanks and Regards

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171207.1 | Last Updated 22 Apr 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100