Tuesday, April 10, 2012

How to Block website using VB.net


 NameSpace : Imports System.IO  
   
 Variables :   
 -----------  
 Dim path As String  
 Dim sw As StreamWriter  
   
 Codes :  
 -------  
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click  
     path = "C:\Windows\System32\drivers\etc\hosts"  
     sw = New StreamWriter(path, True)  
     Dim sitetoblock As String = "\n 127.0.0.1 google.com"  
     sw.Write(sitetoblock)  
     sw.Close()  
     MessageBox.Show("Site Blocked")  
   End Sub  
 End Class  
   

Reactions:

1 comments:

then how to unblock with button ??

Post a Comment