+ Reply to Thread
Results 1 to 2 of 2

Thread: prevent user from visiting a certain web page

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    35

    Lightbulb prevent user from visiting a certain web page

    i want to prevent a user from accessing a certain web page , is there any method to do that in c# ?

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    40
    of course there is a way , actually there is a file called HOSTS , it is located on C:\windows\system32\drivers\etc\hosts , once you add 127.0.0.1 www.google.com , then the user won`t be able to visit google

    how to do in C# :
    Code:
    using System.IO; // you need to use the class IO , since you will manipulate with files
    
                StreamWriter sr = new StreamWriter(@"C:\\windows\\system32\\drivers\\etc\\hosts"); 
                sr.WriteLine("127.0.0.1 google.com");
                sr.Flush();
                sr.Close();

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts