I am developing 1 little application to block website.
I am able to block websites by adding websites name into c:/windows/system32/drivers/etc/hosts file.
Java |
Its working great.
But now i want to unblock blocked website.so i have to delete that specific line from hosts file.
So can u please tell me how to erase line from this hosts file.???
Please reply me soon.I am waiting.
Thanx in advance.

Christian Wirth8 reputationPosted Jun 25, 2009, 9:43 PM EDT
string text = File.ReadAllText(@"C:\host.file"); text.Replace("127.0.0.1 www.google.com", string.Empty); File.WriteAllLines(@"C:\host.file", new[] { text });