How to erase line from hosts file?

Jun 25 2009 9:33 AM
HI...

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.

 string path=@"c:\windows\system32\drivers\etc\hosts";

streamwriter sw=new streamwriter(path,true);

sw.writeline("127.0.0.1 www.google.com");

sw.close();


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.


Answers (1)